I just read the QUOTING section (sorry for missing it). It looks like -q option solves the issue for my use case (single encoder command for media files) and the man page example could be fixed by changing $i to \"$i\".
Perhaps that section and the -q option should also be mentioned in the `sem' man page to highlight them? On Thu, Aug 13, 2020 at 7:28 PM Abon B <gnuabon...@gmail.com> wrote: > > 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?