script to open terminal, run command and keep terminal open
32,364
Solution 1
The argument after -e is taken as a command to be executed. So for xterm, this works:
xterm -hold -e ls
I don't have Konsole installed, but this should work:
konsole --noclose -e ls
Solution 2
From man xterm
The -ls flag and the loginShell resource are ignored if -e is
also given
That's why you got error in your first command.
This command worked for me.
xterm -hold ls
Related videos on Youtube
Comments
-
user1700890 about 1 monthI have simple goal of creating script to open terminal, run command and then keep terminal open.
Here is what I tried:
#!/bin/bash xterm -e -hold lsIt generates the following error:
xterm: Can't execvp -hold: No such file or directoryThen I also tried
#!/bin/bash konsole -e --noclose lsThis simple does not do anything, when I double-click it. (I made sure that script file is executable)
I do not want to use
gnome-terminalas it requires creating profile forgnome-terminalfirst.Would it be easier to do in python?
-
Rahul over 5 yearsIn your first command I think
holdis considered as a file or directory. -
user1700890 over 5 years@Rahul thank you, do you know how to fix it?
-
-
Douglas James Bock over 2 yearsI know it's been a while, and I've started my own thread here, but this does not make the terminal interactive. No further commands can be run after the terminal opens. How can you make the terminal interactive?