In as script I have the statement
eval cp "$chapter"/subsections/* $temp/subsections
However, I am not sure there are actually files in “$chapter”/subsections/. As a consequence I get errors :
cp: cannot stat `Commissioning/subsections/*': No such file or directory
Is there an option in cp to avoid complaints (I couldn’t find any) ?
Is there a simple way to check existence of any file in a directory ?
It’s not really
cpcomplaining. When you use wildcards like*, the shell replaces them with the complete list of all matching files. When no files match, it just leaves the*, tellingcpto copy file named*.You can use the following trick instead:
Now you will be passing the whole directory to
cp, with request to copy it recursively. And since you are referring to it through.,cpwon’t copy its name but only the contents.