You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
914 B
26 lines
914 B
#!/bin/bash |
|
|
|
# Try to run a command in an appropriate type of terminal window |
|
# depending on whats available |
|
# Sigh: theres no common way of handling command line args :-( |
|
name="$1" |
|
shift |
|
echo "Starting $name : $*" |
|
# default to xterm as it has the most consistent options and can start minimised |
|
if [ -n "$DISPLAY" -a -x /usr/bin/xterm ]; then |
|
/usr/bin/xterm -iconic -xrm 'XTerm*selectToClipboard: true' -n "$name" -name "$name" -T "$name" -hold -e $* & |
|
elif [ -n "$DISPLAY" -a -x /usr/bin/konsole ]; then |
|
/usr/bin/konsole --hold -e $* |
|
elif [ -n "$DISPLAY" -a -x /usr/bin/gnome-terminal ]; then |
|
/usr/bin/gnome-terminal -e "$*" |
|
elif [ -n "$STY" ]; then |
|
# We are running inside of screen, try to start it there |
|
/usr/bin/screen -X screen -t $name $* |
|
else |
|
filename="/tmp/$name.log" |
|
echo "Window access not found, logging to $filename" |
|
cmd="$1" |
|
shift |
|
( $cmd $* &>$filename < /dev/null ) & |
|
fi |
|
exit 0
|
|
|