On Fri, 14 Sep 2001, Derek Harding wrote:
Ok, why when I type cp /home/trial/USER.MAN /home/*/ does it reply: omitting /home/trial2 omitting /home/trial3 I want to copy the files to all directories under home. Not stupid! Don't forget that cp -h will list the options for you. You need to use -R to copy directories recursively.
This is irrelevant. You need to think for a few seconds about how Unix command expansion works. Suppose /home contained three folders, trial, trial2 and trial3. Then /home/*/ would expand to /home/trial/ /home/trial2/ /home/trial3/ You can verify this by typing "echo /home/*/" Now consider how the command "cp /home/trial/USER.MAN /home/*/" would expand: cp /home/trial/USER.MAN /home/trial/ /home/trial2/ /home/trial3/ As with most operating systems' copy commands, cp assumes that arguments are of the general form cp SOURCE1 SOURCE2 SOURCE3 ... SOURCEN DEST Thus the command is clearly not going to achieve the desired result! Something like for i in /home/*/; do cp /home/trial/USER.MAN $i; done would do the trick as long as none of the folders in /home have spaces in their names. Incidentally, this is related to a well-known gaffe of Unix sysadmins. Suppose you want to remove all hidden files and folders (i.e. those beginning with a .) in a particular directory. The "obvious" command would be something like rm -rf .* However, a quick "echo .*" will show that it expands to include both "." (i.e. the whole current directory) and ".." (i.e. the parent directory). A quick recipe for wiping large parts of your file system! HTH, Michael Brown Fen Systems Ltd. -- http://www.fensystems.co.uk/