if

쉘 스크립트에서 조건부 처리를 수행. 참고: test, [. 더 많은 정보: https://www.gnu.org/software/bash/manual/bash.html#Conditional-Constructs.

if {{조건_명령어}}; then {{echo "Condition is true"}}; fi

if ! {{조건_명령어}}; then {{echo "Condition is true"}}; fi

if {{조건_명령어}}; then {{echo "Condition is true"}}; else {{echo "Condition is false"}}; fi

if [[ -f {{경로/대상/파일}} ]]; then {{echo "Condition is true"}}; fi

if [[ -d {{경로/대상/디렉터리}} ]]; then {{echo "Condition is true"}}; fi

if [[ -e {{경로/대상/파일_또는_디렉터리}} ]]; then {{echo "Condition is true"}}; fi

if [[ -n "${{변수}}" ]]; then {{echo "Condition is true"}}; fi

man [