Contents

System/OS
2003.04.23 10:36

[linux] 셀 스크립트 if, for, case in..

Views 13742 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
스크립트   인수1   인수2   인수3

#!/bin/sh
echo $1; echo $2; echo $3


if then, elif, else 제어문
echo -n 'enter a number : '
read number

if [ $number -lt 0 ]
then
    echo smaller than zero

elif [ $number -eq 0 ]
then
    echo zero

else
    echo bigger than zero
fi


case in 제어문
for color in blue red green
do
    echo one color is $color
done


case in 제어문
case 변수 in

        "first")
                first 경우의 실행 코드
                ;;
        "second")
                second 경우의 실행 코드
                ;;
        "third")
                third 경우의 실행 코드
                ;;
        *)
                Default 경우
                ;;
esac 


?

List of Articles
No. Category Subject Author Date Views
70 System/OS [linux] 간단한 vi편집기 사용 명령 hooni 2003.04.23 13522
69 System/OS [linux] 간단한 NAT 설정 script hooni 2003.04.23 12645
68 System/OS [linux] 간단한 find 명령어 설명(업데이트 해야 함) hooni 2013.04.23 9166
67 System/OS [linux] yum 업데이트 시 커널 제외하기 hooni 2014.09.11 1399
66 System/OS [linux] X환경 GNOME에서 KDE로 바꾸는 법.. hooni 2013.04.23 12410
65 System/OS [linux] Xwindow/Xmanager 사용 hooni 2003.04.23 13381
64 System/OS [linux] wget 명령 사용 예제 hooni 2020.05.26 1584
63 System/OS [linux] vi 편집기 간단한 명령과 환경설정 hooni 2003.04.23 11406
62 System/OS [linux] The Ultimate Wget Download Guide With 15 Awesome Examples hooni 2020.05.26 972
61 System/OS [linux] ssh에서 원격 파일 전송하기.. hooni 2013.04.23 14204
60 System/OS [linux] SSH에 대한 기본 설명과 설치/설정 hooni 2013.04.23 10649
59 System/OS [linux] split 명령어 hooni 2014.03.11 4371
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 17 Next
/ 17