3

First of all I believe that gnome-terminal is very similar to mate-terminal so a solution for either these 2 will work. The proglem is that I have created a desktop entry to connect with ssh to my server as shown below:

[Desktop Entry]
Name=SSH
Comment=Connect to server
Exec=mate-terminal -e "ssh -X [email protected]"
Terminal=false
Icon=utilities-terminal
Type=Application

But when I close the window I get no warning even if there is a command that is being executed. So I change the Exec line as this:

Exec=mate-terminal -x bash -c "ssh -X [email protected]"

But I still get no warning when I close the terminal window. How can I get a warning like this: enter image description here

3
  • bash -c is clever enough to replace itself with the single command as its argument, hence your two examples are essentially the same. Try to trick bash -c into not being able to exit prior to ssh's completion, e.g. bash -c "ssh -X user@host; true". Not sure if it works, but worth a try.
    – egmont
    Aug 23, 2016 at 10:08
  • @egmont It didn't work. I think that the ; character waits the command to exit before the next command is executed, so true will be executed after I exit the ssh connection. Aug 23, 2016 at 15:10
  • Yes that's why I though it would work: there are two processes, a parent bash and a child ssh (as opposed to your previous examples where bash quits and only ssh remains). Nevermind.
    – egmont
    Aug 23, 2016 at 18:17

2 Answers 2

0

I found the solution. I added the -i option after bash as this:

Exec=mate-terminal -x bash -i -c "ssh -X [email protected]"

and the problem solved.

1
  • Doesn't work for me. Even with bash -i -c "ssh my.server" the terminal doesn't warn on close.
    – raj
    Jun 14, 2020 at 11:06
0

I try this command to solved the issue.

Exec=mate-terminal -e "bash -i  -c 'ssh -X [email protected]';bash"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .