If Condition Types in Bash

Multi Line:

if [[ $INSTALLED != "yes" ]]; then
	echo "Error message."
fiCode language: Bash (bash)
if [[ $INSTALLED != "yes" ]]; then
	echo "Error message."
else
	echo "Message."
fiCode language: Bash (bash)

One Line:

if [[ $INSTALLED != "yes" ]];then echo "Error message."; fiCode language: Bash (bash)
if [[ $INSTALLED != "yes" ]];then echo "Error message."; else echo "Message."; fiCode language: Bash (bash)

Another One Line Method:

[[ $INSTALLED != "yes" ]] && echo "Error message." || sleep 0Code language: Bash (bash)
[[ $INSTALLED != "yes" ]] && echo "Error message." || echo "Message."Code language: Bash (bash)

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.