8.1.【定义函数】
• myfunction(){
echo “This is my first shell function”
}
-----------------
unset myfunction //取消函数
• myfunction(){
echo "This is a new function“
}
8.2.【函数的使用】
myfunction
8.3.【练习1】
lsl(){
ls –l
}
cd “$1” && lsl
8.4.【练习2】
readPass() {
PASS=""
echo -n "Enter Password: "
stty -echo
read PASS
stty echo
echo
}
readPass
echo Password is $PASS
--------------------------------------------------------