Question

I'm trying to open gnome-terminal (though I think it would be related to any x-terminal-emulator) with a command provided using -e option, like gnome-terminal -e 'ls'. The terminal is closed as soon as the command is done working, so I need a way to wait for user input to be able to read the result and then finally close the window with Enter press.

I tried gnome-terminal -e 'ls; read -p "..."' and it works if I run ls; read -p "..." in an already opened terminal, but a terminal called with -e option keeps getting closed.

So is there any way to keep the terminal open until some user input is provided while using -e option?

Was it helpful?

Solution

Spawn a shell;

xterm -e bash -c 'ls; read -p "Press any key ..."'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top