Skip to content

Instantly share code, notes, and snippets.

@RashidJorvee
Created February 12, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RashidJorvee/9e9de5c6f8fd2303d0438b492ee9ad33 to your computer and use it in GitHub Desktop.
Save RashidJorvee/9e9de5c6f8fd2303d0438b492ee9ad33 to your computer and use it in GitHub Desktop.
If else and nested if else in Bash Shell scripting.
# Program in Bash Shell
CHECK_SOURCE="[main] INFO com.dobe.jcr.checknode.existence.App - Node exists"
echo $CHECK_SOURCE | grep -w -o -i 'Node exists'
if [ $? == 0 ]; then
echo " Node Exists"
echo $CHECK_SOURCE | grep -w -o -i 'checknode'
if [ $? == 0 ]; then
echo "checknode exist"
echo $CHECK_SOURCE | grep -w -o -i 'adobe'
if [ $? == 0 ]; then
echo "Adobe exist"
else
echo "Adobe doesnot Exist"
fi
else
echo "checknode doesnot Exist"
fi
else
echo "Node doesnot Exists"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment