Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Jun 18, 2010 7:32 pm 
Offline

Joined: Fri Jun 18, 2010 7:15 pm
Posts: 1
Website: http://philhersh.com
Thanks to caker for the excellent stackscripts he has written. They are a lesson and tutorial in great shell scripting techniques and automating system install and management.

Stackscript 1 has a "goodstuff" function which makes a few nice changes to the .bashrc:

Code:
    sed -i -e 's/^#PS1=/PS1=/' /root/.bashrc # enable the colorful root bash prompt
    sed -i -e "s/^#alias ll='ls -l'/alias ll='ls -al'/" /root/.bashrc # enable ll list long alias <3


I noticed the script failed on my default .bashrc cause it contained a space after the comment hash:

Code:
# PS1='\u@\h:\w\$ '
# alias ll='ls -l'


I'm not a very experienced shell scripter, but I think a simple update to the regex will ignore any spaces between the comment mark and the start of the commands which will allow the function to work on both cases:

Code:
sed -e 's/^ *#PS1=/PS1=/' bashrc
sed -e "s/^ *#alias ll='ls -l'/alias ll='ls -al'/" bashrc


Thanks,
Phil


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group