LINUX
2012.05.05 12:59

[Shell Script] Shell Script 기본

조회 수 27844 댓글 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 Android Git 특정 commit 상태로 되돌리고 SHA1 값 알아내기 2015.05.13 6451 0
175 C# How to: Programmatically Add an Entry to Outlook Contacts 2015.05.27 6502 0
174 Android android pm 명령어 정리 2015.06.01 13379 0
173 C# Thread 클래스 파라미터 전달 2015.06.04 28304 0
172 PHP PHP 문자열 다루기 2015.06.30 25130 0
171 Pi 라즈베리 파이 B+ GPIO file 2015.07.12 12203 0
170 Android Fake Incoming Call Android 2015.07.23 6906 0
169 C# 윈도우 App 설정값 유지하기 (Properties.Settings.Default. , Settings.settings 이용) 2015.08.03 16470 0
168 Android Android sdk 번호(Api level)와 버전 정리 2015.08.05 36775 0
167 C# Web URL로부터 파일 다운로드 하기 2015.08.20 19949 0
166 일반 VP9 코덱 2015.09.01 7787 0
165 LINUX 내 .bashrc 설정 secret 2015.08.31 0 0
164 C# TreeView의 rootnode(TreeNode)에서 하위 항목 찾기 2015.09.21 15266 0
163 C# ArrayList를 string[] 배열로 변환하는 방법 2015.09.23 13237 0
162 PHP 파일 데이터 저장하고 불러오기(파일 입출력) 2015.09.30 8835 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