help with sed
hey, I need a bit of help using the command sed
what I want to do is include in a script a line which changes the umask inside of a user's .bashrc from some searching, I think i'm 90% of the way there with: Code:
grep umask .bashrc | sed 's/$1/umask 027/g' .bashrc |
well geez, 5 more min of searching and I answered my own question
Code:
grep umask .bashrc | sed 's/{$1}/umask 027/g' .bashrc |
Another way is
Code:
sed -i '/umask/s%.*%umask 027%' .bahsrc Code:
sed -i 's%umask ...%umask 027%' .bashrc Edit: I tested your command and does not work for me... |
Just a little add-on: if you want to be sure that user's .bashrc files contain a unique line with the umask command, you can consider something like this:
Code:
if [ $(grep -c umask .bashrc) -eq 1 ] |
Well, my command doesn't work within a script, but it does work directly from the command line for me... odd that it wouldn't for you colucix. I'm using centOS if you can think of any relevant differences. Anyways, because I DO want to use this line in a script I was about to post and ask about another way to do it, but you've answered my question before I asked it colucix, thanks!
|
All times are GMT -5. The time now is 12:21 AM. |