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)

unor
  • 3,196

2 Answers2

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.

user
  • 30,336
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.