5

I 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 ls

It generates the following error:

xterm: Can't execvp -hold: No such file or directory

Then I also tried

 #!/bin/bash

   konsole -e --noclose ls

This 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-terminal as it requires creating profile for gnome-terminal first.

Would it be easier to do in python?

2
  • 1
    In your first command I think hold is considered as a file or directory.
    – Rahul
    Jun 23, 2017 at 17:45
  • @Rahul thank you, do you know how to fix it? Jun 23, 2017 at 17:47

2 Answers 2

6

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
1
  • 1
    I 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? Feb 13, 2020 at 10:08
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.