diff options
author | Mathias Gumz <akira@fluxbox.org> | 2016-04-25 18:11:14 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-04-25 18:11:14 (GMT) |
commit | a11035440c30eda5b14118694f6f9aa15c0105ea (patch) | |
tree | f8cf2508264244158040799b72ea658ff44e9abf /util/fbsetbg | |
parent | 5d90b7984cb73ede2763346382fb6e038ae5d16d (diff) | |
download | fluxbox-a11035440c30eda5b14118694f6f9aa15c0105ea.zip fluxbox-a11035440c30eda5b14118694f6f9aa15c0105ea.tar.bz2 |
fix fbsetbg in combination with picky shells
in *BSD, /bin/sh is Almquist Shell(ash). the 'hash' built-in command of ash
returns 0, always. 'hash' is not usable for find_it() function in
util/fbsetbg and util/fluxbox-generate_menu.in.
this patch changes the behavior of find_it(): when 'hash' is detected to
not work correctly, switch back to 'which'.
this patch is the work of Yamashiro, Jun and appeared first as patch-160
on sourceforge: https://sourceforge.net/p/fluxbox/patches/160/. i submit
it on behalf of the author.
Diffstat (limited to 'util/fbsetbg')
-rw-r--r-- | util/fbsetbg | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index 17c2efe..0cf9cfb 100644 --- a/util/fbsetbg +++ b/util/fbsetbg | |||
@@ -133,9 +133,20 @@ Common tips to use with $command: | |||
133 | EOF | 133 | EOF |
134 | } | 134 | } |
135 | 135 | ||
136 | find_it() { | 136 | # some shell's hash returns 0 always |
137 | [ -n "$1" ] && hash $1 2> /dev/null | 137 | if hash this_program_does_not_exist-no_really-aA1zZ9 > /dev/null 2>&1; then |
138 | } | 138 | # can't rely on return value |
139 | # ash / ksh | ||
140 | find_it() { | ||
141 | which "$1" > /dev/null 2>&1 | ||
142 | } | ||
143 | else | ||
144 | # can rely on return value | ||
145 | # bash / dash / zsh / sh on Solaris | ||
146 | find_it() { | ||
147 | [ -n "$1" ] && hash "$1" 2> /dev/null | ||
148 | } | ||
149 | fi | ||
139 | 150 | ||
140 | message() { | 151 | message() { |
141 | 152 | ||