Search

Friday 22 January 2010

Linux - Run multiple commands together

Just create your script or from command line put && between commands. This logical operator 'and' will run the first command, then if successful will run the second. If the first fails the command chain will stop. i.e.

./configure && make && make install

The other logical operator available is || this means 'or' for example, run a script and if it fails print a warning, i.e.

./some_script || echo "The script isn't working!"

No comments:

Post a Comment