VietHung soft group -
elif [ -d $dir ]
then
echo "Duong dan [$dir] da ton tai"
else
echo "Ca duong dan [$dir], tep [$file va tep moi $newfile]
deu khong ton tai"
fi
6.5 CÊu tróc rÏ nh¸nh nhiÒu tr−êng hîp: case
CÊu tróc case cã thÓ ®−îc hiÓu qua tËp c¸c tõ khãa sau:
case <biÕn>
in
biÕn-1)
<lÖnh>
biÕn-2)
<lÖnh>
biÕn-3)
<lÖnh>
...
*) #cßn
l¹i
exit
esac
VÝ dô 9: VÝ dô vÒ case ®èi víi tham sè ®Çu vµo cña mét tÖp ch−¬ng tr×nh.
#!/bin/sh
#Vi du 9
size=0
page=200
option = “”
while [ "$1" != "" ]
do
case
$1
in
-?) echo “Su dung cac tham so –l,-p,-s.”
exit;;
-l) line = 50
page = 500
option = “$option page[$page] line[$line] “
shift;;
-p) line = 40