10

I would like to start 'xfce4-terminal' and then run a command but finish with a prompt to repeat the command.

I use the software 'todo.txt' and like to have it open in a small window which I can refer to and add entries, etc.

At the moment, I have the following command line which works...

xfce4-terminal --title=todo &

...I then have to switch to that terminal window and type...

/usr/local/bin/todo.sh -t ls

I have the tried all these but on each try it 'finishes' the window and will not let me type in the window:-

xfce4-terminal --execute '/usr/local/bin/todo.sh -t ls' --title=todo --hold &

xfce4-terminal --command '/usr/local/bin/todo.sh -t ls' --title=todo --hold &

xfce4-terminal --command='/usr/local/bin/todo.sh -t ls' --title=todo &

Can anyone help please?

I would like to open the terminal window, run the command, then leave me with a working prompt.

Thanks.

3
  • Please try xfce4-terminal --execute '/usr/local/bin/todo.sh -t ls; bash' --title=todo --hold
    – dessert
    Nov 27 '17 at 13:01
  • ...; exec bash would be even better. Nov 27 '17 at 13:19
  • Alas, I get an error exactly the same as the other times "Failed to execute child process "/usr/local/bin/todo.sh -t ls; bash" (No such file or directory)" Nov 27 '17 at 17:52
13

Use -c option for bash command to wrap multiple commands, like this:

$ bash -c "ls /var/log/apt; bash"
history.log    history.log.4.gz  term.log.10.gz  term.log.5.gz
history.log.10.gz  history.log.5.gz  term.log.11.gz  term.log.6.gz
history.log.11.gz  history.log.6.gz  term.log.12.gz  term.log.7.gz
history.log.12.gz  history.log.7.gz  term.log.1.gz   term.log.8.gz
history.log.1.gz   history.log.8.gz  term.log.2.gz   term.log.9.gz
history.log.2.gz   history.log.9.gz  term.log.3.gz
history.log.3.gz   term.log      term.log.4.gz
username@hostname:~$ 

Then, use that bash command in xfce4-terminal command, like this:

xfce4-terminal -e 'bash -c "ls /var/log/apt; bash"' -T "Run and ready"

whereby the options: -e to run the commands, -T to set the title.

As a result, the terminal does not close and ready with a new prompt.

1
  • 1
    Yay! Fantastic... problem solved, thanks! $ xfce4-terminal -e 'bash -c "/usr/local/bin/todo.sh -t ls; bash"' -T "todo" Dec 7 '17 at 10:16

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.