3. KitWorks TeamStudy - Shell Script
shell script를 사용하는 이유는?
가장 큰 이유는
반복되는 작업을 자동화하기 위해
스크립트형태로 미리 만들어 놓고 실행만 하도록 하기 위해서
이렇게 하면 스케줄링을 돌려서 파일만 실행하도록 할 수 있고,
스크립트의 내용을 몰라도 누구나 실행할 수 있다
개발환경구성, 배치, 서버작업, 복잡한 빌드, 시스템점검 등의 자동화
8. -
KitWorks TeamStudy - Shell Script
Loop
for i in ${arr_test_string[@]}; do
echo $i
done
for (( i = 0; i < 10; i++)); do
printf $i
done
9. -
KitWorks TeamStudy - Shell Script
Conditional statement
test_num=5
if [ "${test_num}" -eq 2 ]; then
echo "number is 2"
elif [ "${test_num}" -eq 3 ]; then
echo "number is 3"
else
echo "number is not 2 or 3"
fi
if (( ${test_num} > 3 )); then
echo "number is greater than 3"
else
echo "number is not greater than 3"
fi