0
다음 스크립트로의 와일드 카드 확장을 막으려 고 시도하면 작동하지 않습니다. (. * m, "*하는 .m"\ 나는 또한 시도)Bash 스크립트에 대한 와일드 카드 확장이 작동하지 않음
$ getLargeNumFiles.sh $(pwd) '*.m'
그리고
$ myDirectory
$ file1.m file2.m file3.m
$ find: paths must precede expression
$ Usage: find [-H] [-L] [-P] [path...] [expression]
$ 0 #The result of my function. Found 0 .m files. Should be 3.
getLargeNumFiles.sh
#!/bin/bash
# Syntax
# getLargeNumFiles [folderPath][ext]
# [folderPath] The path of the folder to read.
# To use at folder to search: $(pwd)
function largeRead()
{
numFiles=0
while read line1; do
#echo $line1
((numFiles++))
done
echo $numFiles
}
folderPath=$1
ext=$2
echo $folderPath
echo $ext
find $folderPath -name $ext | largeRead
고마워! 정말 잘됐다! – ABC