aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/fbsetbg17
-rwxr-xr-xutil/fluxbox-generate_menu.in29
2 files changed, 36 insertions, 10 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:
133EOF 133EOF
134} 134}
135 135
136find_it() { 136# some shell's hash returns 0 always
137 [ -n "$1" ] && hash $1 2> /dev/null 137if 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 }
143else
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 }
149fi
139 150
140message() { 151message() {
141 152
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index 085d622..d319098 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -145,13 +145,28 @@ testoption() {
145 esac 145 esac
146} 146}
147 147
148find_it() { 148# some shell's hash returns 0 always
149 [ -n "$1" ] && hash $1 2> /dev/null && shift && "$@" 149if hash this_program_does_not_exist-no_really-aA1zZ9 > /dev/null 2>&1; then
150} 150 # can't rely on return value
151 # ash / ksh
152 find_it() {
153 which "$1" > /dev/null 2>&1 && shift && "$@"
154 }
151 155
152find_it_options() { 156 find_it_options() {
153 [ -n "$1" ] && hash $1 2> /dev/null 157 which "$1" > /dev/null 2>&1
154} 158 }
159else
160 # can rely on return value
161 # bash / dash / zsh / sh on Solaris
162 find_it() {
163 [ -n "$1" ] && hash "$1" 2> /dev/null && shift && "$@"
164 }
165
166 find_it_options() {
167 [ -n "$1" ] && hash "$1" 2> /dev/null
168 }
169fi
155 170
156#echo "replaceWithinString: $1, $2, $3" >&2 171#echo "replaceWithinString: $1, $2, $3" >&2
157#echo ${1//$2/$3} # causes error in BSD even though not used 172#echo ${1//$2/$3} # causes error in BSD even though not used
@@ -203,7 +218,7 @@ convertIcon(){
203 if [ -f "${entry_icon}" ]; then 218 if [ -f "${entry_icon}" ]; then
204 : echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2 219 : echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2
205 else 220 else
206 if hash convert 2> /dev/null; then 221 if find_it_options convert; then
207 convert "$1" "$entry_icon" 222 convert "$1" "$entry_icon"
208 # echo convert "$1" , "$entry_icon" >> $ICONMAPPING 223 # echo convert "$1" , "$entry_icon" >> $ICONMAPPING
209 else 224 else