use hash instead of which in fbsetbg
This commit is contained in:
parent
4bd62b771c
commit
97c5f12615
1 changed files with 3 additions and 22 deletions
25
util/fbsetbg
25
util/fbsetbg
|
@ -129,28 +129,9 @@ Common tips to use with $command:
|
|||
EOF
|
||||
}
|
||||
|
||||
# some which's have a reliable return code, some don't
|
||||
# Lets figure out which which we have.
|
||||
if which this_program_does_not_exist-no_really-aA1zZ9 >/dev/null 2>/dev/null; then
|
||||
# can't rely on return value
|
||||
find_it() {
|
||||
file=`which $1 2> /dev/null`
|
||||
if [ -x "$file" ]; then
|
||||
if [ $# -gt 1 ]; then
|
||||
shift
|
||||
$*
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
else
|
||||
# can rely on return value
|
||||
find_it() {
|
||||
which $1 > /dev/null 2>&1 && shift && $*
|
||||
}
|
||||
fi
|
||||
find_it() {
|
||||
[ -n "$1" ] && hash $1 2> /dev/null
|
||||
}
|
||||
|
||||
message() {
|
||||
|
||||
|
|
Loading…
Reference in a new issue