"Bash if"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
30번째 줄: 30번째 줄:
==같이 보기==
==같이 보기==
* [[if]]
* [[if]]
* [[Bash if true/false]]
* [[Bash case]]
* [[Bash case]]
* [[Bash 숫자 비교]]
* [[Bash 숫자 비교]]

2021년 10월 19일 (화) 12:56 판

1 개요

Bash if
Syntax
if [조건]; then
	# if 블럭
else
	# else 블럭
fi

2 예시

He="John Smith"
if [ "$He" = "John Smith" ]; then
	echo "He is John Smith"
else
	echo "He is not John Smith"
fi
# He is John Smith
He="Jane Doe"
if [ "$He" != "John Smith" ]; then
	echo "He is not John Smith"
fi
# He is not John Smith

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}