Consider the following example in the `sem' man page:

         for i in *.log ; do
           echo $i
           sem -j+0 gzip $i ";" echo done
         done
         sem --wait

If any of the log files have spaces in them, then gzip considers the
space a separator
and is called on each part of the filename.

Example:

touch 'example log with spaces.log'
for i in *.log; do echo $i; sem -j+0 gzip $i ";" echo done; done

Output:

done
gzip: example: No such file or directory
gzip: log: No such file or directory
gzip: with: No such file or directory
gzip: spaces.log: No such file or directory

This occurs even when putting quotes around the $i.

What's the best way to use the semaphore behavior with such input?

Reply via email to