CrPy wrote:
Hi ng,

sorry, but I think you don't get the problem. Type sleep 1000000h <Enter>
in your shell. And now don't kill it or stop it. Now imagine that you actually forgot what you really wanted: To halt the machine after the program (that already runs and may be it will need to run for some hours because it is a compile process or similar). And imagine that you don't want to sit all the time behind your computer and wait until the program finishes to be able to halt the computer. So, what I want is, to append to the aready running command line a new command without stopping the old (because then it would have to start it from the beginning). I think, it would be ok to suspend the running program temporarily and to resume it after a short time where I append the additional command to it.


After all it should look like i never executed
sleep 1000000h
but sleep 1000000h; halt


One solution I have is to suspend the command with <ctrl><alt><z> and type
fg; halt

But what if I have a longer queue of commands and I like to edit the command line.

e.g.
make clean && make dep && make bzImage && make module && make modules_install

And now I see that I have a typo in the line (the make module -> make modules). How can I change the entered command line while excuting this command line?

Sorry, it was not easy for me to explain it in a way that somebody else could understand it. Maybe it is more clear now.

THX

/CrPy


-- [EMAIL PROTECTED] mailing list



I got what you meant from the first post but what you're asking for is not trivial!!

First stop is the job control section of the bash manual (If you use less as your pager, do a man bash and hit /^J <enter>). You should also check out the bugs section and the comments regarding compound commands & sequences.

You will definately want to suspend the running job with <ctrl>-z (no <alt> needed!) or start it in the background with &

You can get the process id of a running job from jobs -p, you may also want to explore the -l option.

A hackish solution might be a script which greps/awks these values and awaits the disappearance of the pid from /proc or ps's output before executing the command but I can't see a way you'd be able to retrospectively capture the exit code of the job in order to make a decision based on it.

I don't know when bash parses the command string you enter but I guess it's probably all done by the time the process is started - allowing you to go back and change it sounds tricky and would need work on bash itself. You could try making a feature request to the maintainers of bash - their emails are in the man page but if it conflicts with any of the sh compatibility I doubt they'd go for it..

Alternatively check out the other shells available like ksh, csh etc. They all have slightly different job control features - maybe there's one to suit you better than bash out there.

Having said all that I just read Robert's post - if all you want to do is tack on extra commands like the halt example you gave then that's surely the easiest way to go.

Good luck

Bryn



--
[EMAIL PROTECTED] mailing list



Reply via email to