I want to execute a command from terminal which uses the output of another command as an argument, so I used $ operator as in
sudo arpspoof -i wlan0 $(/sbin/ip route | awk '/default/ { print $3 }')
The above command works fine if I execute it from a terminal, However I want to run the same command as a keyboard shortcut, on adding the keyboard shortcut with command
gnome-terminal -e "sudo arpspoof -i wlan0 $(/sbin/ip route | awk '/default/ { print $3 }')"
is not delivering me the result. The terminal opens up as expected, however on entering the password the terminal closes abruptly.
It also works fine if I use static argument as in
gnome-terminal -e "sudo arpspoof -i wlan0 192.168.0.1"
It is a command that will never exit, it will execute for infinity.