Check exit code directly (SC2181)

This commit is contained in:
Tim Byrne 2017-01-06 17:05:06 -06:00
parent 2033e5673e
commit 635468b707
No known key found for this signature in database
GPG Key ID: 6CBE24C2FD8CF76E
1 changed files with 2 additions and 4 deletions

6
yadm
View File

@ -221,8 +221,7 @@ function decrypt() {
fi
#; decrypt the archive
($GPG_PROGRAM -d "$YADM_ARCHIVE" || echo 1) | tar v${tar_option}f - -C "$YADM_WORK"
if [ $? = 0 ] ; then
if ($GPG_PROGRAM -d "$YADM_ARCHIVE" || echo 1) | tar v${tar_option}f - -C "$YADM_WORK"; then
[ ! "$DO_LIST" = "YES" ] && echo "All files decrypted."
else
error_out "Unable to extract encrypted files."
@ -269,8 +268,7 @@ function encrypt() {
echo
#; encrypt all files which match the globs
tar -f - -c "${GLOBS[@]}" | $GPG_PROGRAM --yes "${GPG_OPTS[@]}" --output "$YADM_ARCHIVE"
if [ $? = 0 ]; then
if tar -f - -c "${GLOBS[@]}" | $GPG_PROGRAM --yes "${GPG_OPTS[@]}" --output "$YADM_ARCHIVE"; then
echo "Wrote new file: $YADM_ARCHIVE"
else
error_out "Unable to write $YADM_ARCHIVE"