LINUX
2012.05.05 12:59

[Shell Script] Shell Script 기본

조회 수 27593 댓글 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
번호 분류 제목 날짜 조회 수 추천 수
401 JAVA [Java] 자바에서 콜백(Callback) 구현하기 2017.03.15 25983 0
400 Android json 데이터 다루기 - GSon 사용법 2017.03.15 8471 0
399 Python json 데이터 핸들링 2017.03.09 8687 0
398 Pi 라즈베리파이 gpio utility 2017.02.15 6254 0
397 C++ STL queue 사용법 2017.02.14 28523 0
396 C++ C++ string 정리 (C++ 문자열) 2017.02.14 13098 0
395 Pi 라즈베리파이 3, Spec & PIN Map file 2017.02.06 30596 0
394 일반 Anet A8 Prusa i3: tips and tricks 2017.02.04 22658 0
393 MFC [Collection] ArrayList 예제 2017.01.25 6578 0
392 MFC [Collection] CArray Class 사용법 2017.01.25 15898 0
391 업무 ABS / PLA 2017.01.18 6024 0
390 Pi NodeMCU PIN 정보 file 2017.01.09 8989 0
389 Pi SD Memory 카드 SPI 3.3V/5.0V 인터페이스 모듈 Atmega2560 제어 예제 2016.12.27 6839 0
388 Pi ATTINY85 PIN정보, Data sheet 2 file 2016.12.10 9097 0
387 Pi 키르히호프의 법칙 2016.12.05 10463 0
목록
Board Pagination ‹ Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5