aboutsummaryrefslogtreecommitdiff
path: root/util/fluxbox-generate_menu.in
diff options
context:
space:
mode:
authormarkt <markt>2007-01-02 05:43:25 (GMT)
committermarkt <markt>2007-01-02 05:43:25 (GMT)
commit590b6c93d922a9940cb4c3d78d21509b289bd643 (patch)
tree04895360bf1c118505edeeaed4e7e446ebc0426c /util/fluxbox-generate_menu.in
parent1cad4ca517ef9f4fb96b3c83970ed96767d6668e (diff)
downloadfluxbox-590b6c93d922a9940cb4c3d78d21509b289bd643.zip
fluxbox-590b6c93d922a9940cb4c3d78d21509b289bd643.tar.bz2
replace `which' in fbsetbg and fbgm with `command -v'
Diffstat (limited to 'util/fluxbox-generate_menu.in')
-rwxr-xr-xutil/fluxbox-generate_menu.in45
1 files changed, 8 insertions, 37 deletions
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index 80a2af2..cd168fc 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -124,42 +124,13 @@ fluxbox-generate_menu was brought to you by:
124EOF 124EOF
125} 125}
126 126
127# some which's have a reliable return code, some don't 127find_it() {
128# Lets figure out which which we have. 128 command -v $1 > /dev/null 2>&1 && shift && "$@"
129if which this_program_does_not_exist-no_really-aA1zZ9 2> /dev/null 1> /dev/null; then 129}
130 # can't rely on return value
131 find_it() {
132 file=`which $1 2> /dev/null`
133 if [ -x "$file" ]; then
134 if [ $# -gt 1 ]; then
135 shift
136 "$@"
137 fi
138 return 0
139 else
140 return 1
141 fi
142 }
143
144 find_it_options() {
145 file=`which $1 2> /dev/null`
146 if [ -x "$file" ]; then
147 return 0
148 else
149 return 1
150 fi
151 }
152
153else
154 # can rely on return value
155 find_it() {
156 which $1 > /dev/null 2>&1 && shift && "$@"
157 }
158 130
159 find_it_options() { 131find_it_options() {
160 which $1 > /dev/null 2>&1 132 command -v $1 > /dev/null 2>&1
161 } 133}
162fi
163 134
164#echo "replaceWithinString: $1, $2, $3" >&2 135#echo "replaceWithinString: $1, $2, $3" >&2
165#echo ${1//$2/$3} # causes error in BSD even though not used 136#echo ${1//$2/$3} # causes error in BSD even though not used
@@ -211,7 +182,7 @@ convertIcon(){
211 if [ -f "${entry_icon}" ]; then 182 if [ -f "${entry_icon}" ]; then
212 : echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2 183 : echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2
213 else 184 else
214 if which convert &> /dev/null; then 185 if command -v convert &> /dev/null; then
215 convert "$1" "$entry_icon" 186 convert "$1" "$entry_icon"
216 # echo convert "$1" , "$entry_icon" >> $ICONMAPPING 187 # echo convert "$1" , "$entry_icon" >> $ICONMAPPING
217 else 188 else
@@ -1378,7 +1349,7 @@ fi
1378# prefix 1349# prefix
1379PREFIX="${PREFIX:=@PREFIX@}" 1350PREFIX="${PREFIX:=@PREFIX@}"
1380if [ -z "${PREFIX}" -o ! -d "${PREFIX}" ]; then 1351if [ -z "${PREFIX}" -o ! -d "${PREFIX}" ]; then
1381 PREFIX=`which fluxbox | sed 's,/bin/fluxbox$,,'` 1352 PREFIX=`command -v fluxbox | sed 's,/bin/fluxbox$,,'`
1382fi 1353fi
1383 1354
1384 1355