Hi again,

> Hello,
> 
> There should be quotes around the $(command) for the -x test shell
> builtin: [ -x "$(command)" ]
> This is owing to the following:
> 
> debian:~# which rsync
> /usr/bin/rsync
> debian:~# which rsync_x
> debian:~# [ -x "$(which rsync)" ] && echo ok
> ok
> debian:~# [ -x "$(which rsync_x)" ] && echo ok
> debian:~# [ -x $(which rsync) ] && echo ok
> ok
> debian:~# [ -x $(which rsync_x) ] && echo ok
> ok
> debian:~#
> 

[...]

Thanks a lot for debugging this; in fact I wonder whether you do some kind of
(automated?) code inspection or what is it that makes you discover all these
hidden issues!?

Furthermore, thanks for providing the nice counter-example. I must, however,
admit that I don't quite like the patch. Or, rather, I'd like to go a bit
further. The quotes are fine and maybe even necessary to catch cases where the
path to rsync contains whitespace. This, however, will likely cause a number of
other errors and won't be seen on too many systems. To catch the more likely
case of a missing rsync command I'd suggest the following:

which rsync && [ -x $(which rsync) ] && echo ok

(Well, maybe even a which rsync && echo ok would be just as fine.)

Comments are welcome!

Best,
Michael

Attachment: pgpIhpsZ7hIh8.pgp
Description: PGP signature

Reply via email to