삽질도 두드려 보고,

DESIGN YOUR EXPERIENCE

코스 전체목록

닫기

Shell script

If 문

if [ "$DISPLAY" == "localhost:0.0" ]
then
    echo "DISPLAY is set"
else
    echo "DISPLAY is not set"
fi

case 문

case "$DISPLAY" in
    "localhost") echo "DISPLAY is set only host address";;
    "localhost:0") echo "DISPLAY is set (0)";;
    "localhost:0.0") echo "DISPLAY is set (0.0)";;
    *) echo "DISPLAY is not set";;
esac

while 문

a=0
while [ "$a" -lt 10 ]
do
    echo $a
    ((a++))
done

until 문

a=0
until [ "$a" -eq 10 ]
do
    echo $a
    ((a++))
done

for 문

for i in 1 3 5
do
    echo "outer: $i"
    for j in `seq 11 3 17`
    do
        echo "inner: $j"
    done
done
for file in /etc/*
do
 ls $file
done

댓글

댓글 본문
버전 관리
Hyunseok Lim
현재 버전
선택 버전
graphittie 자세히 보기