Day 11 : Error Handling in Shell Scripting
Error Handling in Shell Scripting π
Checking Exit Status β
:
Use $? to capture the exit status of the last command. If itβs not zero, handle the error.
Example:
bashCopy codemkdir /tmp/mydir
if [ $? -ne 0 ]; then
echo "π« Failed to create ...
devopsinsightwithshivani.hashnode.dev5 min read