#!/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 關注
- 139 瀏覽
添加回答
舉報
0/150
提交
取消