[Linux] 리눅스 쉘 프로그래밍 (2)
·
🌏 OS/Linux
리눅스 쉘 프로그래밍 (2) 1. 조건문 쉘 스크립트 조건문 if-then-fi 조건 명령어, command 실행 결과에 따른 서로 다른 command를 실행 if grep 계정명 /etc/passwd &> /dev/null then 계정이 존재합니다 else 계정 생성 fi case $var의 값에 따라 선택해서 명령어를 실행 echo -n "What do you want?" read answer case $answer in yes) echo "System restart.";; no) echo "shutdown the system.";; *) echo "entered incorrectly";; esac 2. 반복문 쉘 스크립트 반복문 while 다음의 command가 성공하는 동안 do~done 사이의..