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 ?
if cp /folder/path /to/path /tmp && cp /anotherfolder/path /to/anotherpath ;then
echo "ok"
else
echo "not"
fi
cp /folder/path /to/path && cp /anotherfolder/path /to/anotherpath if [ $? -eq 0 ] ; then echo "Succeeded" else echo "Failed" fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With