各位大大~~~~大家辛苦了 小弟发一个脚本 ……………………………………………………………… function PING_STATUS () { local _ipadd _ipadd=$1 PING_COUNT=`ping -c 4 $1` if [ $? -eq 0 ];then # return 0 echo "ping is ok" #ping success elif [ $? -ne 0 ];then # return 1 echo "ping is error" #ping error fi } PING_STATUS $IP …………………...
比如下面的shell脚本文件: #===========test.sh: #! /bin/sh echo_line() { echo date echo "Wellcome to shell func!" } echo_hello() { echo "Hello World!" } #====================== 怎么在shell下调用以上两个函数啊? 为什么我用【./test.sh echo_hello】却什么也没有输出? 当然,我已经给test.sh加了可执行权限了。
在shell里,有2个函数: a() { export a b c echo -e "input" read a b c } b() {export a b c echo -e "input" read a b c } 我想另外些个函数代替 a 和 b中的共同语句,并且在 a,b中调用,怎么做啊?
我这样写System("sudo iptables -n -L -v",$result);就可以执行返回的$result也是0 可是把iptables -n -L -v 写到shell文件里面,然后调用System("sudo ./show.sh ",$result);就不能执行 返回的$result也是1 show.sh的内容为 #!/bin/bash iptables -n -L -v 这是为什么啊? 大家帮忙!!