Skip to content

Commit

Permalink
Improve execution of post and pre commands
Browse files Browse the repository at this point in the history
Resolve #4
  • Loading branch information
frdmn committed Feb 26, 2017
1 parent 65fd5a5 commit 023e837
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions multibackup
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ if [[ "${#pre_commands[@]}" -ne 0 ]]; then
# Run each pre command
for pre_command in "${pre_commands[@]}"; do
info "Running \"${pre_command}\":"
eval "${pre_command}"
# Check if pre command ran successfully
if [[ ${pre_command} ]]; then
if [[ $? -eq 0 ]]; then
success "Pre command \"${pre_command}\" successfully completed!"
else
error "Pre command \"${pre_command}\" failed..."
Expand Down Expand Up @@ -163,8 +164,9 @@ if [[ "${#post_commands[@]}" -ne 0 ]]; then
# Run each post command
for post_command in "${post_commands[@]}"; do
info "Running \"${post_command}\":"
eval "${post_command}"
# Check if post command ran successfully
if [[ ${post_command} ]]; then
if [[ $? -eq 0 ]]; then
success "Post command \"${post_command}\" successfully completed!"
else
error "Post command \"${post_command}\" failed..."
Expand Down

0 comments on commit 023e837

Please sign in to comment.