Both Brad and Mankoff's solutions are good suggestions. Another that's similar to a combination of both them would be to use GNU Screen to implement your queue. This has the advantage of being able to run in the background, you can check on it whenever, and queueing up new commands just pastes them into the buffer to be executed after the previous commands exit.
First, run:
$ screen -d -m -S queue
(incidentally, now's a good time to play with some awesome .screenrc files)
That will spawn up a background screen session for you named queue.
Now, queue up as many commands as you like:
screen -S queue -X stuff "echo first; sleep 4; echo second^M"
I'm doing multiple commands in the above just for testing. Your use case would probably look more like:
screen -S queue -X stuff "echo first^M"
screen -S queue -X stuff "echo second^M"
Note that the "^M" in my line above is a way to get an embedded newline that will be interpreted later after screen stuffs it into your existing bash shell. Use "CTL-V, " to get that sequence.
It'd be pretty easy to make some simple shell-scripts to automate that and queue up commands. Then, whenever you want to check the status of your background queue, you re-attach via:
screen -S queue -r
Technically, you don't even need to name your screen session and it will work fine, but once you get hooked on it, you're going to want to leave one running all the time anyway. ;-)
Of course, if you do that, another good way to do it would be to name one of the current windows "queue" and use:
screen -S queue -p queue -X stuff "command"
3May I suggest that you accept an answer that solves your problem. It seems that there are a couple of them that would work for you. – holmb – 2013-02-22T14:49:08.267
2Yes you may, and I have wanted to. Problem is that I asked this when I worked at a company that were using Macs. I am no longer working there, nor do I have any Macs myself so I have no way of testing any of these. Don't feel comfortable with marking one as an answer when I am unable to test that it actually works, so for now I have hoped that people vote up those answers they find work well for them so the "answer" can emerge in that way instead. – Svish – 2013-02-24T10:55:07.770