PDA

View Full Version : The && command


Business_Woman
January 14th, 2009, 15:39
Hi,

As you know its possible to use the `&&` command for execution for another command after the first one finish. For example make buildworld && make buildkernel...

However is there a way to accomplish this once the buildworld command has already been started, and spewing text?

//Business_Woman

DutchDaemon
January 14th, 2009, 16:05
Type (in the blind, in the shell running the make process):

bash:
if [ $? == 0 ]; then make buildkernel; fi

sh:
if [ $? = 0 ] ; then make buildkernel; fi

kamikaze
January 14th, 2009, 17:47
You mean like, append another command while buildworld is already running?

In the tcsh shell it works like this:


You press CTRL-Z, this will stop the current process.
Then you use the fg command to continue it and append something to it. E.g. 1 && shutdown -p +3

DutchDaemon
January 14th, 2009, 17:57
I type blind commands through a storm of screen output quite a lot ;) I usually do not stop major make operations like that, because they spawn all kinds of sub-processes which may not respond favourably to a foot on the brakes in the main process.

kamikaze
January 14th, 2009, 18:24
I've done that many times when running buildworld or portmaster.

DutchDaemon
January 14th, 2009, 18:37
Hey, you're a kamikaze ...

kamikaze
January 14th, 2009, 20:03
You mean I have sunk a Chinese invading fleet? I do not recall doing that.

jb_fvwm2
January 14th, 2009, 23:41
A CLI I am hesitant to learn as alt-F(number) seems so much
easier... I guess the buildworld is being done over ssh?

DutchDaemon
January 15th, 2009, 13:51
The OP wants to run a command depending on the successful exit status of the command that's already running. That needs to be done in the same shell, i.e. in the same console.

Business_Woman
January 15th, 2009, 16:12
Yes, thank you. I have the answer to my question :)