【发布时间】:2014-02-06 00:41:47
【问题描述】:
我目前在我的项目目录中。
$ pwd
/home/karthik/Projects
我从 cmdline 执行以下操作。
gnome-terminal --tab --working-directory="/home/karthik/mininet" -e "sudo ./my_topo.sh"
我希望上面的命令执行以下操作
1) open a tab
2) go to working directory `/home/karthik/mininet`
3) execute the script `my_topo.sh`
相反,它似乎做了以下事情。
1) open a terminal.
2) go to working directory `/home/karthik/mininet`
3) execute the script `my_topo.sh`
另外在相关说明中,如何打开具有 sudo 权限的选项卡,这样我就不必输入密码?
我尝试了以下操作
WID= xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}'; xdotool windowfocus $WID; xdotool key ctrl+shift+t $WID
这确实会打开一个新选项卡,但是如何在新选项卡而不是旧选项卡中执行以下命令。
cd /home/karthik/mininet;
sudo ./my_topo.sh
【问题讨论】:
标签: linux bash ubuntu sudo gnome-terminal