I have a peculiar problem I can't seeem to solve. 

I want to create a series of links for usernames where the name of the
links point to the user's home directory. All users have a hyphen at the
end of their username followed by a letter (which letter varies). I want
to make links, generated from a file containing these usernames, but the
names of the links themselved should not contain the hyphen and whatever
leter follows that hyphen. The list of users is very long so I do not
want to do it by hand. 

So what I want to do is this: suppose I have a user called jones-m, then
I want a link to his directory in a directory underneath ie making a
link as follows 

ln -s ../jones-m jones

But I have to repeat this for a very long list of usernames ie I want to
automate this. 

The script I wrote tries to take the -* out of the username for the name
of the link (in this case jones). 

But the sed command I invoke does not want to run on "$i" because it
requires a file. My script is as follows (where $1 refers to a file with
usernames in it (including the -*, eg jones-m): 

#!/bin/zsh
for i in `cat $1`
do
ln -s ../$i `sed 's/-.//' $i`
echo
echo $i done
done          

As I said, the problem lies in  `sed 's/-.//' $i`, but if I substitute a
filename for $i with the names jones etc (names with no -), it still
won't run.

Anyone has a solution to this? 

Thanks

Hugo  

-- 
Dr Hugo Bouckaert - Systems Administrator, Computer Science UWA
Tel: +(61 8) 9380 2878 / Fax: +(61 8) 9380 1089
Email: [EMAIL PROTECTED] / Web: http://www.cs.uwa.edu.au/~hugo

Reply via email to