On 21 April 2016 at 03:53, Jakub Wilk <jw...@debian.org> wrote: > Policy §10.4 says that /bin/sh script need to follow SUSv3 + some > extensions. Both "hash" and "command -v" are optional in SUSv3 (but they are > mandatory in SUSv4), so in theory you shouldn't use them. In practice, > however, "command -v" is probably more portable than anything else. > > "which" is not standardized, but you can rely on it as far as Debian in > concerned, because it's shipped by an essential package. > > Related bugs: #747320, #733511
Thank you very much for the reference. Also, this is the first time I've seen the section symbol "§". So just to clarify, both "command -v" and "which" are acceptable for Debian work, and which one I use is a matter of preference? I consulted the Policy, which recommended checking the script with "checkbashisms." Checkbashisms reports: possible bashism in btrfs-progs.postinst line 7 ('command' with option other than -p) I assume this can be disregarded, but it makes me wonder if "which" is most Debian-correct in the strictest sense, because it can be relied on "because it's shipped by an essential package" and because there is no possible conflict with Policy § 10.4. >> In this case, I think it broke on piuparts because piuparts used bash; so >> I think this was an dashism rather than a bashism ;-) > > > You can't rely on the output format of argumentless "hash"; but other than > that it works fine in both dash and bash. Guilty as charged! Cheers, Nicholas