for f in /bin /usr/bin /home/fred;do echo $f;ls $f|head;done
will loop through the list of directories to do operations on each item of the list referenced by $f. Replace the ls |head part with some copy operation like cp a.sh $f
That will do the operations sequentially. If you have a lot of files and file-systems, it may be faster to do the operations in parallel. In that case replace the ;done with &done.
For information read man bash
It is unusual to do copies like this. Usually, there is one copy made and in the other locations there is a link to the first copy, like this:
for f in a b c;do ln -s /usr/bin/myscript.sh $f/myscript.sh ;done
Further, for executables, one's PATH variable lists likely locations of executables so an executable or link need be found in only one of several directories. One can add some new directory to one's PATH.
This can be done in one's ~/.bashrc file to set the PATH variable on each login.
Last edited by RobertP; 11-09-2014 at 09:21 AM.