更详细的版本(从另一个窗口使用):#!/bin/bashDELAY=3TERM_PID=$(echo `ps -C gnome-terminal -o pid= | head -1`) # get first gnome-terminal's PIDWID=$(wmctrl -lp | awk -v pid=$TERM_PID '$3==pid{print $1;exit;}') # get window idxdotool windowfocus $WIDxdotool key alt+t # my key mapxdotool sleep $DELAY # it may take a while to start new shell :(xdotool type --delay 1 --clearmodifiers "$@"xdotool key Returnwmctrl -i -a $WID # go to that window (WID is numeric)# vim:ai# EOF #