Results 1 to 3 of 3
Hi all,
I have been asked to change the font for everyones email signature at work, which are all stored in staff's individual folders. Thought a small script would do ...
- 06-04-2007 #1Just Joined!
- Join Date
- May 2007
- Posts
- 2
Script writing
Hi all,
I have been asked to change the font for everyones email signature at work, which are all stored in staff's individual folders. Thought a small script would do the trick nicely, but I am returned this error:
./fontchg: line 2: syntax error near unexpected token `%%G'
./fontchg: line 2: `for /R %%G in do'
Here is the script:
#!/bin/bash
for /R %%G in do
sed s/ariel/verdana/g email_signature.htm
done
So its supposed to go through everyones folder, find 'email_signature.htm' and replace any instance of the word ariel with verdana. This is my first attempt at script writing so I guess the syntax is a little out, any help would be great.
- 06-05-2007 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
let me see whether I understand this
> staffs' individual folders
something like this:
/home/ahmed
/home/bwk
/home/carolj
and in each one, the file "email_signature.htm" is to be changed
If so, try something like this:
cd /home
for i in *
do
cd $i
# backup the file
cp email_signature.htm email_signature.htm.old
cat email_signature.htm | sed 's/ariel/verdana/g' >em_new
cp em_new email_signature.htm
cd ../
donethe sun is new every day (heraclitus)
- 06-05-2007 #3Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
TPL, your script works only in the /home directory and for all users, try this:
RegardsCode:find /home -group "staff" -name email_signature.htm -exec sed -i.old 's/ariel/verdana/g' {} \;


Reply With Quote