Shell脚本:带有参数的函数来计算文件数

时间:2017-04-19 23:03:41

标签: shell

我需要编写一个以目录位置为参数的函数,并计算该目录的文件数。

file_count() { LOCATION=$1

FILECOUNT=$(find $LOCATION -maxdepth 1 -type f | wc -l)
echo "$FILECOUNT"
 }
LOCATION1=/etc
echo "$LOCATION1" 
file_count LOCATION1

0 个答案:

没有答案