 |
Linode Forum Linode Community Forums
|
| Author |
Message |
phersh
Joined: 18 Jun 2010
Posts: 1
|
| Posted: Fri Jun 18, 2010 6:32 pm Post subject: Small tweek to Stackscript 1 goodstuff function |
|
|
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 |
|
| Back to top |
|
| |
|