UNIX Shell Script
出自KMU Wiki
目錄 |
[編輯] 動機
為什麼要學 Shell Script
- automatic (自動化)
- batch (批次)
[編輯] Variable
YOURVAR=some MYVAR=thing echo $YOURVAR echo ${YOURVAR}${MYVAR}
[編輯] Flow control
if [ -f your_file ]; then echo "your_file exists" else echo "your_file not exists" fi
for f in a b c do echo $f done
[編輯] Sub Program
sub() { echo $1 $2 $3 } sub X Y Z
[編輯] Examples
#!/bin/sh exec < $1 while read line do echo $line done