日期:2014-05-16 浏览次数:20763 次
#!/bin/sh:/bin/bash export PATH=/usr/bin:/bin:/sbin:/usr/sbin:$PATH init_env() { echo "初始化环境" #yum install ncurses* gcc+ gcc-c++ openssl* gcc gcc++ cmake } install_vim() { echo "安装Vim" } do_install() { for a in "$@" do echo "执行:"${arry[$a]} ${arry[$a]} done } arry[1]="init_env"; arry[2]="install_vim" #${arry[1]} #${arry[2]} echo "please choose which you want to setup." echo -e "1:init_env \t 2:install_vim" read -a choosed if [ -z "$choosed" ] then echo "no choose" do_install ${arry[@]} else echo "choose" do_install ${choosed[@]} fi
#sh b.sh please choose what you want to setup. 1:init_env 2:install_vim 1 choose 执行:init_env 初始化环境