diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-23 11:30:59 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-23 11:30:59 (GMT) |
commit | 97c5f126158f82f6edfd1ea13278c85824f41548 (patch) | |
tree | 03ec3eb3437aafcaa48b6aee4e61c25dfc92acdc /util | |
parent | 4bd62b771c483144e939629cb95a4fafd5943b43 (diff) | |
download | fluxbox_pavel-97c5f126158f82f6edfd1ea13278c85824f41548.zip fluxbox_pavel-97c5f126158f82f6edfd1ea13278c85824f41548.tar.bz2 |
use hash instead of which in fbsetbg
Diffstat (limited to 'util')
-rw-r--r-- | util/fbsetbg | 25 |
1 files 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: | |||
129 | EOF | 129 | EOF |
130 | } | 130 | } |
131 | 131 | ||
132 | # some which's have a reliable return code, some don't | 132 | find_it() { |
133 | # Lets figure out which which we have. | 133 | [ -n "$1" ] && hash $1 2> /dev/null |
134 | if which this_program_does_not_exist-no_really-aA1zZ9 >/dev/null 2>/dev/null; then | 134 | } |
135 | # can't rely on return value | ||
136 | find_it() { | ||
137 | file=`which $1 2> /dev/null` | ||
138 | if [ -x "$file" ]; then | ||
139 | if [ $# -gt 1 ]; then | ||
140 | shift | ||
141 | $* | ||
142 | fi | ||
143 | return 0 | ||
144 | else | ||
145 | return 1 | ||
146 | fi | ||
147 | } | ||
148 | else | ||
149 | # can rely on return value | ||
150 | find_it() { | ||
151 | which $1 > /dev/null 2>&1 && shift && $* | ||
152 | } | ||
153 | fi | ||
154 | 135 | ||
155 | message() { | 136 | message() { |
156 | 137 | ||