0

I have a problem where I need to launch a command from a terminal, and leave the terminal open with the command I used once it is complete. The reason is that depending on certain circumstances I may need to run it again.

I wrote a bash script to run several terminal commands it looks like this

$ launch.bash /path/to/data

And the snippet looks like

xterm -hold -geometry 200x20+2+700 -e "python /home/me/doSomething.py --directory $1; echo python /home/me/doSomething.py --directory $1; bash"

What this will do now is it will launch the python script and when it completes it will print the command that I used. It would be nice to print the command into the command line itself, so I can hit enter. Is there a way to do this?

1 Answer 1

4

To reenter the command on the command line is not an easy thing to do (without emulating a keyboard in software, I know of no other way). What you can do is rerun the command when you press enter:

while true
do
    xterm -hold -geometry 200x20+2+700 -e "python /home/me/doSomething.py --directory $1; echo python /home/me/doSomething.py --directory $1"
    echo "Press enter to run the command again or CTRL+C to cancel"
    read
done

Or you could just press to go back to the last command ran and press enter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .