Quality Learning Support For All
First time here? Checkout the FAQs!
x
MathsGee is Zero-Rated (You do not need data to access) on: Telkom |Dimension Data | Rain | MWEB

0 like 0 dislike
51 views
Execute combine multiple shell commands in one line.
in Data Science & Statistics by Diamond (81,178 points) | 51 views

1 Answer

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 (81,178 points)

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
0 answers
asked Aug 30, 2019 in Data Science & Statistics by MathsGee Diamond (81,178 points) | 26 views
0 like 0 dislike
0 answers
0 like 0 dislike
1 answer
asked Aug 29, 2019 in Data Science & Statistics by MathsGee Diamond (81,178 points) | 38 views
0 like 0 dislike
0 answers
0 like 0 dislike
0 answers
0 like 0 dislike
0 answers
0 like 0 dislike
1 answer

Join the MathsGee Answer Hub community and get study support for success - MathsGee Answer Hub provides answers to subject-specific educational questions for improved outcomes.



On MathsGee Answers, you can:


  1. Ask questions
  2. Answer questions
  3. Comment on Answers
  4. Vote on Questions and Answers
  5. Donate to your favourite users
  6. Create/Take Live Video Lessons

Posting on MathsGee


  1. Remember the human
  2. Behave like you would in real life
  3. Look for the original source of content
  4. Search for duplicates before posting
  5. Read the community's rules
MathsGee Tools

Math Worksheet Generator

Math Algebra Solver

Trigonometry Simulations

Vectors Simulations

Matrix Arithmetic Simulations

Matrix Transformations Simulations

Quadratic Equations Simulations

Probability & Statistics Simulations

PHET Simulations

Visual Statistics

MathsGee ZOOM | eBook