[root@localhost testdir]# vi cat.sh [root@localhost testdir]# cat cat.sh cat <<END 1 444 2 555 3 666 END [root@localhost testdir]# sh cat.sh 1 444 2 555 3 666 [root@localhost testdir]#
写菜单:
[root@localhost testdir]# cat menu1
menu(){
cat <<END
1. [install LDAP]
2. [install Mysql]
3. [install HTTP]
4. [exit 1]
Pls input num you want:
END
}
menu1(){
cat <<END
1.[version 1.1]
2.[Version 1.2]
3.[version 1.3]
4.[back]
END
}
menu
read i
echo "you select $i"
[ $i -eq 1 ]&& {
menu1
read o
echo "pls selcet version num:"
[ $o -eq 1 ] && {
echo "stating install LDAP version 1.1"
}
[ $o -eq 4 ]&& {
echo "break"
}
echo "stating install LDAP"
#/bin/sh /LDAP-install.sh
exit
}
[ $i -eq 2 ]&& {
echo "stating install Mysql"
#/bin/sh /LDAP-install.sh
exit
}
[ $i -eq 3 ]&& {
echo "stating install HTTP"
#/bin/sh /LDAP-install.sh
exit
}
[ $i -nt "{a..z}" ] && echo 88
[ ! $i -eq 1 -o ! $i -eq 2 -o ! $i -eq 3 ] && {
echo "Pls input right NUM"
exit 1
}
[root@localhost testdir]#原文:http://201438gz.blog.51cto.com/7940496/1371733