# The && command



## Business_Woman (Jan 14, 2009)

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 (Jan 14, 2009)

Type (in the blind, in the shell running the make process):


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

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


----------



## kamikaze (Jan 14, 2009)

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 [cmd=]fg[/cmd] command to continue it and append something to it. E.g. [cmd=fg]1 && shutdown -p +3[/cmd]


----------



## DutchDaemon (Jan 14, 2009)

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 (Jan 14, 2009)

I've done that many times when running buildworld or portmaster.


----------



## DutchDaemon (Jan 14, 2009)

Hey, you're a kamikaze ...


----------



## kamikaze (Jan 14, 2009)

You mean I have sunk a Chinese invading fleet? I do not recall doing that.


----------



## jb_fvwm2 (Jan 14, 2009)

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 (Jan 15, 2009)

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 (Jan 15, 2009)

Yes, thank you. I have the answer to my question


----------

