3

When I make custom commands for Thunar with the xfce4-terminal -x command, sometimes I'd like to see the Terminal output of the command. How can I prevent Terminal from closing after the command is run?

I've tried these:

xfce4-terminal -x COMMAND &
xfce4-terminal -x COMMAND && read -p
xfce4-terminal -x COMMAND && read -p '' foo

They didn't work. Strangely, it won't run the read command. It says:

Failed to execute child process "read" (No such file or directory)

2 Answers 2

7

You should be able to use the --hold (-H) switch for this.

That is, instead of xfce4-terminal -x command you would use xfce4-terminal -H -x command.

The -H switch is described in the man page as:

Causes the terminal to be kept around after the child command has terminated

You would then close the terminal window normally once you are done reading the output of the command.

1
  • Nice! I'm not sure how I missed that switch in the man page. Maybe it's because it's an -H, which is close to the usual -h for "help". Commented Apr 10, 2015 at 23:35
1

The thunar custom action dialog is not a shell, so shell built-ins like && and read don't work. Wrap them in a proper script with #!/bin/sh header and than call the script.

1
  • I accepted the other answer because it's just a little closer to the question, but this solution's solid and would work especially well with complex commands. Commented Apr 10, 2015 at 23:30

You must log in to answer this question.

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