Skip to content

Commit 00e55a2

Browse files
author
emmett1
committed
replace type with command
1 parent 0ee256b commit 00e55a2

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

scratch

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ confirm() {
133133
}
134134

135135
checktool() {
136-
if ! type -p $1 >/dev/null; then
136+
if ! command -v $1 >/dev/null; then
137137
msgerr "'$1' not exist in your system!"
138138
exit 1
139139
fi
@@ -286,37 +286,37 @@ post_triggers() {
286286
done
287287
fi
288288

289-
if [ "$trig_11" = 1 ] && [ $(type -p fc-cache) ]; then
289+
if [ "$trig_11" = 1 ] && [ $(command -v fc-cache) ]; then
290290
echo "trigger: Updating fontconfig cache..."
291291
fc-cache -s
292292
fi
293293

294-
if [ "$trig_10" = 1 ] && [ $(type -p gdk-pixbuf-query-loaders) ]; then
294+
if [ "$trig_10" = 1 ] && [ $(command -v gdk-pixbuf-query-loaders) ]; then
295295
echo "trigger: Probing GDK-Pixbuf loader modules..."
296296
gdk-pixbuf-query-loaders --update-cache
297297
fi
298298

299-
if [ "$trig_9" = 1 ] && [ $(type -p gio-querymodules) ]; then
299+
if [ "$trig_9" = 1 ] && [ $(command -v gio-querymodules) ]; then
300300
echo "trigger: Updating GIO module cache..."
301301
gio-querymodules /usr/lib/gio/modules
302302
fi
303303

304-
if [ "$trig_8" = 1 ] && [ $(type -p glib-compile-schemas) ]; then
304+
if [ "$trig_8" = 1 ] && [ $(command -v glib-compile-schemas) ]; then
305305
echo "trigger: Compiling GSettings XML schema files..."
306306
glib-compile-schemas /usr/share/glib-2.0/schemas
307307
fi
308308

309-
if [ "$trig_7" = 1 ] && [ $(type -p gtk-query-immodules-2.0) ]; then
309+
if [ "$trig_7" = 1 ] && [ $(command -v gtk-query-immodules-2.0) ]; then
310310
echo "trigger: Probing GTK2 input method modules..."
311311
gtk-query-immodules-2.0 --update-cache
312312
fi
313313

314-
if [ "$trig_6" = 1 ] && [ $(type -p gtk-query-immodules-3.0) ]; then
314+
if [ "$trig_6" = 1 ] && [ $(command -v gtk-query-immodules-3.0) ]; then
315315
echo "trigger: Probing GTK3 input method modules..."
316316
gtk-query-immodules-3.0 --update-cache
317317
fi
318318

319-
if [ "$trig_5" = 1 ] && [ $(type -p gtk-update-icon-cache) ]; then
319+
if [ "$trig_5" = 1 ] && [ $(command -v gtk-update-icon-cache) ]; then
320320
echo "trigger: Updating icon theme caches..."
321321
for dir in /usr/share/icons/* ; do
322322
if [ -e $dir/index.theme ]; then
@@ -328,12 +328,12 @@ post_triggers() {
328328
done
329329
fi
330330

331-
if [ "$trig_4" = 1 ] && [ $(type -p udevadm) ]; then
331+
if [ "$trig_4" = 1 ] && [ $(command -v udevadm) ]; then
332332
echo "trigger: Updating hardware database..."
333333
udevadm hwdb --update
334334
fi
335335

336-
if [ "$trig_3" = 1 ] && [ $(type -p mkfontdir) ] && [ $(type -p mkfontscale) ]; then
336+
if [ "$trig_3" = 1 ] && [ $(command -v mkfontdir) ] && [ $(command -v mkfontscale) ]; then
337337
echo "trigger: Updating X fontdir indices..."
338338
for dir in $(find /usr/share/fonts -maxdepth 1 -type d \( ! -path /usr/share/fonts -a ! -name X11 \)) /usr/share/fonts/X11/*; do
339339
rm -f $dir/fonts.scale $dir/fonts.dir $dir/.uuid
@@ -344,12 +344,12 @@ post_triggers() {
344344
done
345345
fi
346346

347-
if [ "$trig_2" = 1 ] && [ $(type -p update-desktop-database) ]; then
347+
if [ "$trig_2" = 1 ] && [ $(command -v update-desktop-database) ]; then
348348
echo "trigger: Updating desktop file MIME type cache..."
349349
update-desktop-database --quiet
350350
fi
351351

352-
if [ "$trig_1" = 1 ] && [ $(type -p update-mime-database) ]; then
352+
if [ "$trig_1" = 1 ] && [ $(command -v update-mime-database) ]; then
353353
echo "trigger: Updating the MIME type database..."
354354
update-mime-database /usr/share/mime
355355
fi
@@ -1195,9 +1195,9 @@ COMPRESSION_MODE="xz"
11951195

11961196
mode=$1
11971197

1198-
if [ -z "$mode" ]; then
1198+
[ "$mode" ] || {
11991199
print_runhelp_msg
1200-
fi
1200+
}
12011201

12021202
shift
12031203

@@ -1222,7 +1222,7 @@ if [ -f "$REPO_FILE" ]; then
12221222
done
12231223
fi
12241224

1225-
if [ "$(type -t scratch_$mode)" = "function" ]; then
1225+
if [ "$(command -v scratch_$mode)" ]; then
12261226
scratch_$mode $MAINOPTS
12271227
else
12281228
print_runhelp_msg

0 commit comments

Comments
 (0)