例如,report jpg 将显示所有名为 something.jpg 的文件。这是我正在处理的代码,包括我的问题。
function report {
x=`ls *.$1`
num=`ls *.$1 | wc -l`
# Question 1:
# Want to use variable for x to get
# num, but num=$($x | wc -l) didn't work for this purpose.
echo There are $num $1 files
if [ $num -lt 10 ]; then
# Question 2:
# for this part, I want to use "find . -name '*.$1'
# with delimiter . to extract filename from its extension
# and display them (Also maybe need to use while or for loop)
fi
}
report jpg
report html