Re: RFE & RFC: testing executability

2017-10-02 Thread PePa
On 10/01/2017 11:31 AM, L A Walsh wrote: cmd=$(PATH=/stdpath type -p cmd) I use this kind of construction with 'type -p' regularly: ! cmd=$(type -p cmd) && echo "ABEND: Executable cmd not in PATH" && exit Then $cmd can be used to execute the binary, and not some alias or function. This is th

Re: RFE & RFC: testing executability

2017-10-01 Thread L A Walsh
Pierre Gaston wrote: Besides the fact that most people don't use alias in script --- That's due to bash being non-POSIX compatible, by default in regard to aliases. Aliases are designed to "always be there" and always be "on" unless explicitly turned off so people could rely on them.

Re: RFE & RFC: testing executability

2017-10-01 Thread Pierre Gaston
On Sun, Oct 1, 2017 at 7:31 AM, L A Walsh wrote: > I was looking at a script that tested command for execute before > executing them. > The script used: > > cmd=$(PATH=/stdpath type -p cmd) > > and later tested executability with "-x $cmd", raising 2 problems. The > first was "-p" returning empt

RFE & RFC: testing executability

2017-09-30 Thread L A Walsh
I was looking at a script that tested command for execute before executing them. The script used: cmd=$(PATH=/stdpath type -p cmd) and later tested executability with "-x $cmd", raising 2 problems. The first was "-p" returning empty if "cmd" was an alias or function. Second was that even