Tools: permit overriding shell to use when running in terminal window
This commit is contained in:
parent
7c7144fd8f
commit
1432763ca5
@ -6,8 +6,25 @@
|
||||
name="$1"
|
||||
shift
|
||||
echo "RiTW: Starting $name : $*"
|
||||
# default to xterm as it has the most consistent options and can start minimised
|
||||
if [ -n "$DISPLAY" -a -n "$(which osascript)" ]; then
|
||||
|
||||
if [ -n "$SITL_RITW_TERMINAL" ]; then
|
||||
# create a small shell script containing the command to run; this
|
||||
# avoids problems where "screen" expects arguments in
|
||||
# argv[1],argv[2],argv[3] where gnome-terminal expects the command
|
||||
# to run be in argv[n+1] where argv[n] is "-e"
|
||||
# this should work with:
|
||||
# export SITL_RITW_TERMINAL="screen -D -m"
|
||||
# export SITL_RITW_TERMINAL="gnome-terminal -e"
|
||||
# export SITL_RITW_TERMINAL="konsole -e"
|
||||
|
||||
test -z "$TMPDIR" && TMPDIR="/tmp/"
|
||||
FILENAME="ritw-`date '+%Y%m%d%H%M%S'`"
|
||||
FILEPATH="$TMPDIR/$FILENAME"
|
||||
echo "#!/bin/sh" >"$FILEPATH"
|
||||
echo "$*" >>"$FILEPATH"
|
||||
chmod +x "$FILEPATH"
|
||||
$SITL_RITW_TERMINAL "$FILEPATH" &
|
||||
elif [ -n "$DISPLAY" -a -n "$(which osascript)" ]; then
|
||||
osascript -e 'tell application "Terminal" to do script "'"$* "'"'
|
||||
elif [ -n "$DISPLAY" -a -n "$(which xterm)" ]; then
|
||||
xterm -iconic -xrm 'XTerm*selectToClipboard: true' -xrm 'XTerm*initialFont: 6' -n "$name" -name "$name" -T "$name" -hold -e $* &
|
||||
|
Loading…
Reference in New Issue
Block a user