All pastes #835262 Raw Edit

Anonymous

public text v1 · immutable
#835262 ·published 2007-12-28 19:52 UTC
rendered paste body
inpath () {
    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