Skip to content

Commit d940ac4

Browse files
committed
Look for binaries on the user's $PATH
shell and terminal binaries aren't always in /usr/bin, and scripts are more portable if they don't hardcode paths. This replaces absolute paths with lookups from the user's `$PATH`. For details, see https://unix.stackexchange.com/questions/29608/
1 parent a1e2d1c commit d940ac4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dw-start.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Run this from crontab periodically to start up
44
# Dire Wolf automatically.
@@ -120,14 +120,14 @@ function GUI {
120120
# Auto adjust the startup for your particular environment: gnome-terminal, xterm, etc.
121121
#
122122

123-
if [ -x /usr/bin/lxterminal ]; then
124-
/usr/bin/lxterminal -t "Dire Wolf" -e "$DWCMD" &
123+
if $(which lxterminal &> /dev/null); then
124+
lxterminal -t "Dire Wolf" -e "$DWCMD" &
125125
SUCCESS=1
126-
elif [ -x /usr/bin/xterm ]; then
127-
/usr/bin/xterm -bg white -fg black -e "$DWCMD" &
126+
elif $(which xterm &> /dev/null); then
127+
xterm -bg white -fg black -e "$DWCMD" &
128128
SUCCESS=1
129-
elif [ -x /usr/bin/x-terminal-emulator ]; then
130-
/usr/bin/x-terminal-emulator -e "$DWCMD" &
129+
elif $(which x-terminal-emulator &> /dev/null); then
130+
x-terminal-emulator -e "$DWCMD" &
131131
SUCCESS=1
132132
else
133133
echo "Did not find an X terminal emulator. Reverting to CLI mode"

0 commit comments

Comments
 (0)