Find and basename not playing nicely

前端 未结 4 1699
無奈伤痛
無奈伤痛 2020-12-13 05:55

I want to echo out the filename portion of a find on the linux commandline. I\'ve tried to use the following:

find www/*.html -type f -exec sh -c \"echo $(b         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-13 06:33

    Try this instead :

     find www/*.html -type f -printf '%f\n'
    

    If you want to do it with a pipe (more resources needed) :

    find www/*.html -type f -print0 | xargs -0 -n1 basename
    

提交回复
热议问题