#!/bin/bashread -p "num=" numfileNum(){while truedoarray1=(`ls /root/mydir`)factnum=${#array1[@]}echo $factnumif [ $num -eq $factnum ];thenbreakfidone}fileNum &在一个shell中后台运行函数fileNum,当/root/mydir目录下文件的数量达到预先设定的$num时,退出函数。问题:例如,将num 设为2 ,并在/root/mydir下建2个文件,但是该函数并不会结束,为什么呢?谢谢!
1 回答
紫衣仙女
TA贡献1839条经验 获得超15个赞
比面shell脚本文件:#===========test.sh! /bin/shecho_line(){ echo date echo "Wellcome to shell func!"}echo_hello(){ echo "Hello World!"}#======================shell调用两函数啊我用【./test.sh echo_hello】却没输我已经给test.sh加执行权限
请问envsetup.sh边
function gettop()
{
local TOPFILE=build/core/envsetup.mk
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
echo $TOP
else
if [ -f $TOPFILE ] ; then
# The following circumlocution (repeated below as well) ensures
# that we record the true directory name and not one that is
# faked up with symlink names.
PWD= /bin/pwd
fi
}并没返值
调用何获取参数 T=$(gettop)
实际参数谢谢
- 1 回答
- 0 关注
- 168 浏览
添加回答
举报
0/150
提交
取消
