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 exist" 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 echo $line done