LINUX
2012.05.05 12:59

[Shell Script] Shell Script 기본

조회 수 27685 댓글 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
번호 분류 제목 날짜 조회 수 추천 수
161 JAVA 자바 프로그래머가 알아야할 10가지 이클립스 단축키 1 2015.10.27 7800 0
160 PHP php 배열 사용하기 2015.10.28 12454 0
159 일반 [HTML] 복사해서 사용가능한 5개의 실용적인 List Style 예제 2015.11.03 7202 0
158 Android 원격 linux 서버에서 local device로 adb 접속하기 secret 2015.11.05 1 0
157 C# Best way to implement keyboard shortcuts in a Windows Forms application 2015.11.06 6777 0
156 일반 NirCmd 사용법 2015.12.08 7917 0
155 C# C#에서 명령줄 인수(command line argument) 사용하기 2016.01.04 12565 0
154 C# string array를 string으로 변환 2016.01.05 18263 0
153 Android 실시간으로 폰의 pcap 보기 2016.01.05 7328 0
152 Python pyBest 소스 secret 2016.01.20 0 0
151 Python pygoogle 파이썬으로 구글 검색결과 가져오기 library 2016.01.20 10004 0
150 LINUX iptables 명령어 - 방화벽 설정 2016.02.01 12816 0
149 JAVA 자바 리스트(List,ArrayList) 이용하는 방법 2016.02.22 28872 0
148 LINUX 삼바(SAMBA)를 이용한 윈도우 접근 가능 공유폴더 만들기 2016.02.23 17971 0
147 LINUX 리눅스 그룹관리 (groupadd, groupmod, groupdel) 2016.02.23 8439 0
목록
Board Pagination ‹ Prev 1 ... 19 20 21 22 23 24 25 26 27 28 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5