"Bash"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
1번째 줄: 1번째 줄:
=[[bash/manual]]=
+
= [[Bash/manual]] =
<source lang='bash'>
+
 
 +
<source lang="bash">
 
$ echo {d..h}
 
$ echo {d..h}
 
d e f g h
 
d e f g h
15번째 줄: 16번째 줄:
 
$ nice
 
$ nice
  
</source>
+
</source>  
  
[[single quotation in single qoute]]
+
[[Single quotation in single qoute]]  
  
<source lang='bash'>
+
<source lang="bash">
 
$ # 'or'  
 
$ # 'or'  
 
$ if [ -z "$1" ] || [ -z "$2" ]; then
 
$ if [ -z "$1" ] || [ -z "$2" ]; then
34번째 줄: 35번째 줄:
 
> done < textfile.txt
 
> done < textfile.txt
  
</source>
+
</source>  
 +
 
 +
[http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html expressions used with if]

2014년 8월 7일 (목) 13:42 판

Bash/manual

$ echo {d..h}
d e f g h

$ echo {d..Z}
d c b a _ ^ ]  [ Z

### cp file1 file2와 같다
$ cat < file1 > file2

$ cut -d: -f1 < /etc/password | sort

### man nice
$ nice

Single quotation in single qoute

$ # 'or' 
$ if [ -z "$1" ] || [ -z "$2" ]; then
>    echo "Usage: `basename $0` rslt_file target_folder"
> fi


$ # for each line of file
$ # do not use 'cat' & 'foreach'
$ # use 'read'
$ # http://stackoverflow.com/a/1521498/766330 
$ while read line; do
>   echo $line
> done < textfile.txt

expressions used with if