大家帮忙看看,我写的脚本错在哪里了? 谢谢
发表于 : 2014-12-08 2:24
function Goo (){
while read line
t=' '
do
echo $line
t=$line
done < $1
exit 0
return $t
}
pgrep rcu|tr '\n\r' ' ' >temp1
sleep 2
pgrep rcu|tr '\n\r' ' ' >temp2
t1=$(Goo temp1)
t2=$(Goo temp2)
echo $t1
if [ "$t1" = "$t2" ]
then
echo "equals..."
else
echo "...."
fi
pgrep命令获取进程ID, 在 Goo函数内读取文件并将返回值传递给变量。然后进行变量的比较。
while read line
t=' '
do
echo $line
t=$line
done < $1
exit 0
return $t
}
pgrep rcu|tr '\n\r' ' ' >temp1
sleep 2
pgrep rcu|tr '\n\r' ' ' >temp2
t1=$(Goo temp1)
t2=$(Goo temp2)
echo $t1
if [ "$t1" = "$t2" ]
then
echo "equals..."
else
echo "...."
fi
pgrep命令获取进程ID, 在 Goo函数内读取文件并将返回值传递给变量。然后进行变量的比较。