MathsGee is free of annoying ads. We want to keep it like this. You can help with your DONATION

0 like 0 dislike
20 views
Execute combine multiple shell commands in one line.
| 20 views

0 like 0 dislike

If you want to execute each command only if the previous one succeeded, then combine them using the && operator:

cd /my_folder && rm *.jar && svn co path to repo && mvn compile package install

If one of the commands fails, then all other commands following it won't be executed.

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

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

In your case, I think you want the first case where execution of the next command depends on the success of the previous one.

You can also put all commands in a script and execute that instead:

#! /bin/sh
cd /my_folder \
&& rm *.jar \
&& svn co path to repo \
&& mvn compile package install
by Diamond (51,000 points)

0 like 0 dislike
0 like 0 dislike
0 like 0 dislike
0 like 0 dislike