Filenames with wildcards in variables

后端 未结 4 652
孤独总比滥情好
孤独总比滥情好 2021-01-13 02:22
#!/bin/bash
outbound=/home/user/outbound/
putfile=DATA_FILE_PUT_*.CSV
cd $outbound
filecnt=0
for file in $putfile; do let filecnt=filecnt+1; done
echo \"Filecount: \         


        
4条回答
  •  爱一瞬间的悲伤
    2021-01-13 02:57

    Not sure why you need a piece of code here. Following one liner should do your job.

    ls ${outbound}/${putfile} | wc -l
    

    Or

    find ${outbound} -maxdepth 1 -type f -name "${putfile}" | wc -l
    

提交回复
热议问题