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
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.
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