how to run multiple command on single line on CentOS

If you want to run multiple command on single line on CentOS.

If you want to execute each command only if the previous one succeeded, then combine them using the  “&&" operator. If one of the commands fails, then all other commands following it won’t be executed.

Example :-cd /my_folder && rpm -ivh  *.rpm && rm -rf *.rpm && service mysql status

If you want to execute all commands regardless of whether the previous ones failed or not, separate them with semicolons “;”

Example:-cd /my_folder; rm *.jar; svn co path to repo; mvn compile package install

Source link

 

Leave a Comment