Creating Inter Variablesnumber=123.45 // type : local string integer counter=12 // type : local integer typeset -i total=32767 exort total // type : export integer integer minimum=-2147483648 // type : local integer Base10 and Otherstypeset -i int_num=10 //value string: 10 typeset -i2 bin_num=10 //value string: 2#1010 typeset -i8 oct_num=10 //value string: 8#12 typeset -i16 hex_num=10 //value st..
Variable Attributes(typeset)typse -L10 var_nameortypeset -L10 var_name="value string" Attribute/typeset option/sampleLeft Justify -L "string " Right Justify -R " string" Lower Case -l "string" Upper Case -u "STRING" Display Formatted DataFormatted: print "$var" Unformatted: print $var Conversion: printf "%.10s" "$var" //built-in cmd인 print와 다르게 external cmd인 printf는 c언어의 printf와 같다. man printf 커..
Readman read //read 메뉴얼 페이지 참조 Positional Parametersprog.sh arga argb argc // prog.sh $0, arga $1, argb $2, argc $3 Positional Parameters는 parent shell의 환경변수로 child shell에 넘어간다. 흥미로운 예$ set asd qwd asd zxc asf dg $ echo $1 asd $ echo $2 qwd $ echo $3 asd $ echo $4 zxc $ echo $5 asf $ echo $6 dg $ echo $* //parameter 1개로 넘어감 asd qwd asd zxc asf dg $ echo $@ //parameter 6개로 넘어감 asd qwd asd zxc asf..
Variablesvariable="value string"variable을 설정시에 equal 기호 전 후로 공백을 넣으면 안된다. 공백은 쉘에서 메타캐릭터이다.variable의 이름은 숫자로 시작하면안된다.variable은 언더바 _ 의 특수기호만을 사용가능하다.variable 값은 shell process 메모리에 저장된다. (Local variable) 따라서 시스템을 껐다키면 사라진다.variable 값은 기본적 데이터 타입은 문자열string이다. 재밌는 예$ aster='*'$ echo $aster // -> $ echo * -> $ echo [files...]programs script test.sh xx.sh$ echo "$aster" // -> $ echo "*" * Variable Sc..
Unix Shell Family treeThompson Shell 1971|_ Bourne (sh) 1977 관리자 기능에서 유용했음 |_ Korn (ksh) 1983 csh과 ksh의 장점 믹스|_ Korn (ksh93) 1993 이 때 POSIX Shell이 HPUX의 표준이됨 |_ Bourne-Again (bash) 1987|_ Cshell (csh) 1978 자동 완성기능 등 프로그래머들 유용한 커맨드 많음 Which Shell Interprects the Script? Hash #, bang ! and absolute path#!/usr/bin/sh Interpret using the POSIX Shell#!/bin/sh Interpret using the POSIX Shell ...#!/bin..
unix가 command 찾는 순서1. alias2. built-in or keyword3. $PATH : 출력되는 경로 순부터 커맨드를 찾는다. short circuit. 경로 맨 뒤에는 현재 디렉토리 . 도 포함되어 있는 것을 확인할 수 있다. type, ls, cd 등의 파일을 현재디렉토리에 생성하고 실행하려해도 short circuit 때문에 작동하지 않는다.이 세 순서로 찾은 뒤 없으면 command not found 라고 뜬다.참고 : $변수 입력 뒤 캐리지리턴시 substitution이 일어나 echo 커맨드를 발생. 또다른 예는 rm *. 오래된 유닉스 시스템 사용 시, 파일이 너무많을경우 rm * 수행시 command too long 에러를 터미널 화면에 리턴함. Shell Script는..
groups Every user on an HP-UX ystem is assigned a primary group membership and up to 20 additional group membership # id user1uid=301 (user1) gid=301(class)#groups user1class class2 users HP-UX PAssword Mechanism1 전통적 pw (default)2 shadow pw3 trusted system /tch/* /etc/passwd FileUsername :보통 8자, 그 이상도 가능하긴하지만 그 이상일 경우 명령어 사용시 짤림.passwd 길이 : 8자#passwd -l user1 //로그인할 수 없음User ID, Group ID : 0 fo..
Arithmetic Evaluation Using let $ x=10$ x=x+1$ echo $xx+1 $ x=10$ let x=x+1 //let command enables shell scripts to use arithmetic expressions$ echo $x11$ (( x=x+1 ))$ echo $x12 $ x=12$ (( x>10 ))$ echo $?0 $ (( x> file.names echo "Continue?" echo enter yes or no read ansdone $ vi sum_them"sum_them" 10 lines, 139 charactersx=1sum=0while (( x > file.names echo "Continue?" echo enter yes or no read..
Return CodesThe shell variable ? holds the return code of the last command executed{$ echo $?1$ adfsh: adf: not found.$ echot $?sh: echot: not found.$ echo $?127$ false$ echo $?1$ echo $?} test commandtest command can evaluate the condition of Integers, Strings, Files [조심! 실습파일은 test 말고 test.sh 등으로 작성, sh는 쉘을 의미]test - Numeric Test-lt, -le, -gt, -ge, -eq, -ne (less, less or equal, greater, great..
shell programming$ cat a.cmain(){ for(;;);} //needs compile, not a shell script $ cat myprog# this is the program myprogdatels -F //shell script shell script and child process $ color=blue$ cat color1echo You are now running program: color1echo the value of the variable color is: $color$ color1You are now running program: color1the value of the variable color is:$ export color //환경변수화$ color1You..
- Total
- Today
- Yesterday
- 아레나
- Arena
- 엄청난 인내심과 시뮬레이션을 위한 아레나 툴
- grafana cloud
- beginning javascript
- paul wilton
- 이산수학
- 대규모 시스템 설계 기초
- Simulation
- 로젠
- 자바스크립트
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 최단경로 알고리즘
- rosen
- Grafana
- 명제논리
- 데이터 중심 애플리케이션 설계
- 백준
- 아레나 시뮬레이션
- arena simulation
- Discrete Mathematics
- 이산 수학
- 그라파나
- 자바스크립트 예제
- javascript
- Propositional and Predicate Logic
- 아레나시뮬레이션
- 항해99
- flutter
- 시뮬레이션
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |