System/OS
2003.04.23 10:36

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

조회 수 13762 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
스크립트   인수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
번호 분류 제목 글쓴이 날짜 조회 수
154 System/OS [perl] 펄 환경 설정해야 할거 ㅋㅋ hooni 2003.04.23 15052
153 System/OS [perl] 영규가 만든 스크립트.. 하하.. hooni 2013.04.23 10680
152 System/OS [owasp] 10대 웹어플리케이션 보안 취약 file hooni 2013.04.23 16001
151 System/OS [mysql] 시간 관련 SQL구문.. hooni 2013.04.23 10882
150 System/OS [mysql] mysql user 생성시 ERROR 1364 hooni 2013.04.25 28620
149 System/OS [mysql] MySQL server has gone away 에러 대응 hooni 2013.05.29 19387
148 System/OS [ms-sql] 프로시져 예제.. file hooni 2013.04.23 13507
147 System/OS [ms-sql] 서브스트링(substring), 프로시저(SP) 작성 예제 hooni 2013.04.23 41398
146 System/OS [mac][추천 무료앱] 구름 입력기 - 국내 맥 사용자를 위한 한글 대안 입력기 1 file hooni 2015.01.04 2313
145 System/OS [mac] 패키지 매니저, MacPort hooni 2015.01.03 1131
144 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18905
143 System/OS [mac] 맥에서 슬립(잠자기) 모드 진입을 막는 방법~ hooni 2013.10.10 31300
142 System/OS [mac] 맥에서 기본 실행 앱 변경하기 file hooni 2018.03.02 1973
141 System/OS [mac] 맥에서 APM(apache,php,mysql) 구성하기 hooni 2013.04.23 38833
140 System/OS [mac] 맥OSX에서 NTFS 쓰기 기능 활성화 hooni 2014.03.12 4374
139 System/OS [mac] 맥(OSX)에서 root 패스워드 설정하기 hooni 2013.04.23 22633
Board Pagination Prev 1 2 3 4 5 6 ... 13 Next
/ 13