2014-03-02 16:06:45 -04:00
|
|
|
#!/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 :-(
|
2014-03-10 19:37:02 -03:00
|
|
|
name="$1"
|
|
|
|
shift
|
|
|
|
echo "Starting $name : $*"
|
|
|
|
# default to xterm as it has the most consistent options and can start minimised
|
|
|
|
if [ -x /usr/bin/xterm ]; then
|
|
|
|
/usr/bin/xterm -iconic -n "$name" -name "$name" -T "$name" -hold -e $* &
|
|
|
|
elif [ -x /usr/bin/konsole ]; then
|
|
|
|
/usr/bin/konsole --hold -e $*
|
|
|
|
elif [ -x /usr/bin/gnome-terminal ]; then
|
|
|
|
/usr/bin/gnome-terminal -e "$*"
|
2015-01-20 15:51:19 -04:00
|
|
|
elif [ -n "$STY" ]; then
|
|
|
|
# We are running inside of screen, try to start it there
|
|
|
|
/usr/bin/screen -X screen -t $name $*
|
2014-03-10 19:37:02 -03:00
|
|
|
else
|
2015-01-20 15:51:19 -04:00
|
|
|
filename="/tmp/$name.log"
|
|
|
|
echo "Window access not found, logging to $filename"
|
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
( run_cmd.sh $cmd $* &>$filename < /dev/null ) &
|
2014-03-10 19:37:02 -03:00
|
|
|
fi
|
2014-03-02 16:06:45 -04:00
|
|
|
exit 0
|