[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sem example in man page is broken if there are spaces in the filenames
From: |
Abon B |
Subject: |
sem example in man page is broken if there are spaces in the filenames |
Date: |
Thu, 13 Aug 2020 19:28:37 +0000 |
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?
- sem example in man page is broken if there are spaces in the filenames,
Abon B <=