[root@u ~]# cat 13.sh
function abc() {
echo 'aaa';
echo 'bbb';
}
abc
[root@u ~]#
[root@u ~]# ./13.sh
aaa
bbb
[root@u ~]# cat 13.sh
function abc() {
echo 'aaa';
return $[ 100 + 299 ]
}
abc
可以有两个程序:
[root@u ~]# cat 13.sh
#function abc() {
# echo 'aaa';
# return $[ 30 + 29 ]
#}
#abc
function install(){
echo "ooo"
}
install
function start() {
echo "ppp"
}
start
如果我想输入install,才输出ooo,可以这样写:
[root@u ~]# cat 13.sh
#function abc() {
# echo 'aaa';
# return $[ 30 + 29 ]
#}
#abc
function install(){
echo " install"
}
function start() {
echo " start"
}
if [ "$1" = "install" ]
then
install
elif [ "$1" = "start" ]
then
start
else
echo "end"
fi
移动到/usr/bin下,可以随时调用
mv 13.sh nginx
mv nginx /usr/bin/
由于nginx本身就是一个软件包名字,所以要改名
mv /usr/bin/nginx /usr/bin/my_nginx