LINUX
2012.05.05 12:59

[Shell Script] Shell Script 기본

조회 수 27540 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
출처 : http://blog.naver.com/yongtil?Redirect=Log&logNo=40059040555

mount 에 디렉토리만 넣어도 마운트 되는 경우는 /etc/vfstab 에 정의되있는 경우.. ex) mount /opt /etc/default/fs --> ufs로 정의되어 있음.. newfs -N /dev/~ --> 파일시스템을 직접 만들지 않고 확인만 함.. fsck -o b=~ /dev/~ ---> 슈퍼블럭 복구.. fstyp -v /dev/rdsk/c0d0s5 | head -20 --> 상태보기.. tunefs -m 3 /dev/rdsk/c0d0s5 --> minfree 조절 ufsrestore -rvf /dev/rdsk/c0d1s0 --> 백업받은거 복구.. ------------------------------------------- #!/bin/sh -> bone shell scripts #!/bin/ksh -> kone shell scripts #!/bin/csk =sub shell(#!는 shell scripts의 시작을 의미) $-> 변수 (실행됨) " " 안에 있는 변수는 실행됨(변수취급해줌) ' ' 안에 있는 변수는 그냥 단순 문자열로 표출됨 \c 는 줄 바꿈 하지 않고 바로 이어써라.. date는 년 월 일 시 분 초 를 표시함..(default) #!/bin/sh clear echo "SCRIPT BEGINS" echo "Hello $LOGNAME" echo echo "Todays date is: \c" date '+%m/%d/%y' echo "and the current time is: \c" date '+%H:%M:%S%n' echo "Now a list of the processes in the current shell" ps echo "SCRIPT FINISHED" ------------------------------------------- /bin/ksh 의 print 는 /bin/sh 의 echo 와 같음.. -n 은 줄바꿈 하지 않고 이어쓰라는 뜻.. #!/bin/ksh clear print "SCRIPT BEGINS" print "Hello $LOGNAME" print print -n "Todays date is: " date '+%m/%d/%y' print -n "and the current time is: " date '+%H:%M:%S%n' print "Now a list of the processes in the current shell" ps print "SCRIPT FINISHED" ------------------------------------------- [ ] 는 조건test ;; -> case 를 빠져나와라.. $? -> 맨마지막에 친 명령어의 종료상태 표시.. $! : 맨마지막에 백그라운드로 실행된 PID number $$ : 현 쉘의 PID number #!/sbin/sh # # Cpoyright (c) 1997-1998 by sun Microsystms, Inc. # All rights reserved # # ident "@(#)volmgt 1.6 98/12/14 SMI" case "$1" in 'start') if [ -f /etc/vold.conf -a -f /usr/sbin/vold ]; then echo 'volname management starting.' /usr/sbin/vold > /dev/msglog 2>&1 & fi ;; 'stop') /usr/bin/pkill -x -u 0 vold ;; *) echo "Usage: $0 { start | stop }" exit 1 ;; esac exit 0
------------------------------------------
shell script는 숫자를 인식못함..문자로..
(( )) 변수를 숫자로 변환 해서 안에서 수치계산..
#!/bin/ksh

y=99

(( cube=y*y*y ))
(( quotient=y/4 ))
(( rmdr=y%4 ))

print "the cube of $y is $cube."
print "the quotient of $y divided by 4 is $quotient."
print "the remainder of $y divided by 4 is $rmdr."

(( z=2*(quotient*4+rmdr) ))
print "Two times $y is $z."
------------------------------------------
TAG •

Dreamy의 코드 스크랩

내가 모으고 내가 보는

List of Articles
번호 분류 제목 날짜 조회 수 추천 수
176 LINUX apt-get 명령어 정리 2013.03.29 14230 0
175 LINUX linux 버전 확인하기 2013.03.29 11463 0
174 LINUX 계정등록(adduser) 기능 및 옵션, 계정 변경(usermod) 5 2013.03.29 17992 0
173 LINUX Samba 설치 및 설정 방법 2013.03.29 17134 0
172 개념 Symmetric Multiprocessing (대칭형 멀티 프로세싱 : SMP) 2013.03.26 15128 0
171 C# 자신의 IP주소 확인하기 2013.02.01 22888 0
170 C# 인터넷 연결상태 확인 2013.02.01 17589 0
169 일반 정규식 요약 2013.01.23 15474 0
168 개념 OMA DRM에서 DCF 란? 2013.01.22 12176 0
167 C# C# 시스템 정보 가져오기 2013.01.18 22109 0
166 C# SmtpClient로 메일 보내기 - gmail 2013.01.18 12262 0
165 C# byte[] <-> string 변환 방법 2013.01.16 40977 0
164 개념 WebP(웹피, weppy) 이미지 포맷 2013.01.09 12693 0
163 LINUX errno.h - system error numbers 2013.01.09 65815 0
162 C# DateTime.ToString 형식 2012.12.24 9985 0
목록
Board Pagination ‹ Prev 1 ... 18 19 20 21 22 23 24 25 26 27 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5