[Précédent (date)] [Suivant (date)] [Précédent (sujet)] [Suivant (sujet)] [Index par date] [Index par sujet]

newbie Making a script



here is the script i wrote ...
#!/bin/bash
#
rm -r /var/www/html/marco/pub/*
rm -r /var/www/html/slap/*
rm -r /home/slap/*
rm -r /home/claude/*
rm -r /home/piero/*
rm -r /var/www/html/coralie/*
rm -r /var/www/html/nat/*
rm -r /var/www/html/anik/*
rm -r /var/www/html/gui/*
#
cp -lrp /pub /var/www/html/marco
cp -lrp /pub /var/www/html/slap
cp -lrp /pub /home/slap
cp -lrp /pub /home/claude
cp -lrp /pub /home/piero
cp -lrp /pub /var/www/html/coralie
cp -lrp /pub /var/www/html/nat
cp -lrp /pub /var/www/html/anik
cp -lrp /pub /var/www/html/gui

all the newbies can do that and understand for what i wrote it, but it
must exist some other methods
to update the content of some folders 9the childs) from a parent folder.

Someone send me this :

#!/bin/bash
#
sourcedir=/branch1/branch2/...
for y in path1 path2 ... pathn
do
cd ${y}
for z in ${sourcedir}/*
do
[ -f $z ] && ln -fs $z
done
done

when i fill it with my folder names like that :

#!/bin/bash
#
sourcedir=/pub
for y in /var/www/html/marco
do
cd ${y}
for z in ${sourcedir}/*
do
[ -f $z ] && ln -fs $z
done
done

I have this : ./myscript : [: too many arguments

could you help ?