Anonymous
public text v1 · immutableinpath () {
needle=$1;
if [ $# < 2 ];
then
local IFS=:;
return $(inpath "$needle" $PATH);
fi;
for straw in "$@"; do
[ "$needle" = "$straw" ] && return 0; ##success
done;
return 1;
}
+ inpath foo
+ needle=foo
+ '[' 1 ']'
bash: 2: No such file or directory
+ for straw in '"$@"'
+ '[' foo = foo ']'
+ return 0