Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash combine Exit command and exit codes to build quick logic

$ my_command && echo "Done" || echo "Failed"
$ /usr/bin/rsnapshot daily && echo "Backup successful" || echo "Backup failed. Alerting OPS team..."
$ mkdir /opt/kernel && cd $_ && echo "Directory created and you are in $PWD"
Source by bash.cyberciti.biz #
 
PREVIOUS NEXT
Tagged: #bash #combine #Exit #command #exit #codes #build #quick #logic
ADD COMMENT
Topic
Name
1+2 =