blob: 3d09a4779d78a39fee6356bb2098d8e7ae443b08 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--- util/fbsetbg.orig 2015-02-08 10:44:45 UTC
+++ util/fbsetbg
@@ -49,7 +49,7 @@ lastwallpaper="${HOME}/.fluxbox/lastwallpaper"
WHOAMI=`whoami`
-[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin
+[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:%%LOCALBASE%%/bin
command="`basename \"$0\"`"
@@ -133,9 +133,28 @@ Common tips to use with $command:
EOF
}
-find_it() {
- [ -n "$1" ] && hash $1 2> /dev/null
-}
+# 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
message() {
|