diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:17:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:17:24 +0000 |
commit | 9d8085074991d5c0a42d6fc96a2d1a3ee918aad1 (patch) | |
tree | c85bca1e6c11eb872edfc64c524d20f2b7e3307b /examples/scripts/inpath | |
parent | Initial commit. (diff) | |
download | bash-upstream.tar.xz bash-upstream.zip |
Adding upstream version 5.1.upstream/5.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/scripts/inpath')
-rwxr-xr-x | examples/scripts/inpath | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/scripts/inpath b/examples/scripts/inpath new file mode 100755 index 0000000..95f28bc --- /dev/null +++ b/examples/scripts/inpath @@ -0,0 +1,19 @@ +#! /bin/sh +# +# Search $PATH for a file the same name as $1; return TRUE if found. +# + +command=$1 +[ -n "$command" ] || exit 1 + +set `echo $PATH | sed 's/^:/.:/ + s/::/:.:/g + s/:$/:./ + s/:/ /g'` + +while [ $# -ne 0 ] ; do + [ -f $1/$command ] && exit 0 # test -x not universal + shift +done + +exit 1 |