user_rak
user_rak

Reputation: 97

open new tab in current window using shell script

I am using centos Linux. I wanted to open a new tab in the current window terminal from a script file named 'myscript'. I use the following script

#!/bin/bash
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID # line 5
xdotool key ctrl+shift+t #line 6
wmctrl -i -a $WID # line 7

referred from this link Open a new tab in gnome-terminal using command line. I run the script in this way source myscript and i get an error saying Illegal variable name. How to fix this ? Note! I don't want to open new tabs in a new window.

Upvotes: 0

Views: 2877

Answers (1)

Gustavo da Silva Serra
Gustavo da Silva Serra

Reputation: 200

The problem is the $(commands) statement. Try to use `` instead:

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

Upvotes: 1

Related Questions