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