BTS

Message1892

Author ft
Recipients maddi, mika
Date 2009-02-15.12:51:25
Content
Well, let me make a fresh start... :-)
I think this will make a final usable version.

[snip]
is_installed() {
    prog="$1"
    [ -z "$prog" ] && return 1

    ret=1
    oifs="$IFS"
    IFS=:
    for dir in $PATH; do
        [ -z "$dir" ] && continue
        [ -x "$dir/$prog" ] && ret=0
    done

    IFS="$oifs"
    unset oifs
    return "$ret"
}
[snap]

Works in posh, dash, bash ksh93 and mksh and in zsh's sh mode(at
least, I did test those). Cannot work in zsh mode, because $PATH
won't split without sh_word_split set.

Then again, in zsh mode, this would be done a *lot* differently.
So, I'm happy with this now.

Sometimes, sleep really helps. :)

Regards, Frank
History
Date User Action Args
2009-02-15 12:51:28ftsetrecipients: + mika
2009-02-15 12:51:28ftlinkissue431 messages
2009-02-15 12:51:26ftcreate