Skip to main content
Formatted text.
Source Link
Paulo Tomé
  • 3.9k
  • 6
  • 28
  • 40

saveSave below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

See https://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnomeOpen a new tab in gnome-terminal-using-command-line using command line.

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

https://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

Save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

See Open a new tab in gnome-terminal using command line.

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

http://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-linehttps://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

http://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

https://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

deleted 78 characters in body
Source Link
rofrol
  • 277
  • 3
  • 7

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

http://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

http://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

save below as script.sh

#!/usr/bin/env bash

me=$(realpath $0)

commands=(
"echo"
"ls -l && echo 'yes'"
"top"
"ps"
)
len=${#commands[@]}

if [ $# -eq 0 ];then
    num=$len
else
    num=$1
fi

n=$((len-num))
command=${commands[$n]}
num=$((num-1))

xdotool key ctrl+shift+t

if [ $num -gt -1 ]; then
    sleep 1; xdotool type --delay 1 --clearmodifiers "$me $num; ${command}"; xdotool key Return;
fi

add script.sh to $PATH then run it

gnome-terminal -x script.sh

http://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line

Source Link
rofrol
  • 277
  • 3
  • 7
Loading