Saturday, June 25, 2011

Running multiple commands

1. Executing Commands in Sequence (Independently)
(Put semi-colon between commands)

# ./configure; make; make install
*The subsequent commands will continue to execute independently whether the prior commands fail or not. This will have impact on subsequent commands
2. Executing Commands in Sequence (Interdependent)
(Put && operator in between commands)
# ./configure && make && make install
* The && is a logical operator. In other words, if the prior commands fail, the subsequent commands will fail

3. Executing Commands Either / Or
# ./configure || echo "something not working in configure"
*  If the 1st command fails, execute the 2nd commands

No comments: