How can I make this if's work in Bash ?

Posted by Dragos on Stack Overflow See other posts from Stack Overflow or by Dragos
Published on 2010-03-24T11:14:14Z Indexed on 2010/03/24 11:23 UTC
Read the original article Hit count: 266

Filed under:
|
|

In bash how can I make a construction like this to work:

if (cp /folder/path /to/path) && (cp /anotherfolder/path /to/anotherpath)
then
  echo "Succeeded"
else
  echo "Failed"
fi

The if should test for the $? return code of each command and tie them with &&.

How can I make this in Bash ?

© Stack Overflow or respective owner

Related posts about bash

Related posts about linux