LINUX
2012.05.05 12:59

[Shell Script] Shell Script 기본

조회 수 27780 댓글 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
번호 분류 제목 날짜 조회 수 추천 수
146 PHP GD 라이브러리 간단 2014.07.09 9537 0
145 Pi 라즈베리파이 PI CAMERA 설치하기 2018.04.24 9528 0
144 일반 사용하지 않는 COM Port 삭제하기 2015.03.18 9486 0
143 Android adb 를 이용한 터치 이벤트 보내기 2014.07.30 9447 0
142 Pi ATTINY85 PIN정보, Data sheet 2 file 2016.12.10 9432 0
141 일반 Html에서 사용하는 contentType의 종류 2015.10.27 9414 0
140 Pi 라즈베리파이를 크롬캐스트 처럼 사용하는 방법 - RaspiCast 2017.10.17 9332 0
139 LINUX 리눅스 명령행에서 메일 보내기(send mail from linux command line) 2019.11.25 9262 0
138 Pi NodeMCU PIN 정보 file 2017.01.09 9231 0
137 C# Download Files from Web [C#] 2014.09.11 9203 0
136 LINUX 명령어 뒤의 옵션 자동완성 기능, complete 명령어 2015.01.06 9095 0
135 LINUX epoch time을 실제 시간으로 변환해주는 excel 함수 2015.03.18 9094 0
134 Android ion memory 사용량 확인하기 2014.12.03 9017 0
133 Python json 데이터 핸들링 2017.03.09 8978 0
132 C++ istringstream 을 이용한 string type 변환 & 토크나이징 2017.06.07 8958 0
목록
Board Pagination ‹ Prev 1 ... 20 21 22 23 24 25 26 27 28 29 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5