From 97c5f126158f82f6edfd1ea13278c85824f41548 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Wed, 23 Jan 2008 03:30:59 -0800 Subject: use hash instead of which in fbsetbg --- util/fbsetbg | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/util/fbsetbg b/util/fbsetbg index d11f5ee..64c8728 100644 --- a/util/fbsetbg +++ b/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() { -- cgit v0.11.2