Use bash to find first folder name that contains a string

后端 未结 3 1038
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 12:58

I would like to do this in Bash:

  • in the current directory, find the first folder that contains \"foo\" in the name

I\'ve been playing around with th

3条回答
  •  渐次进展
    2021-01-30 13:24

    You can use the -quit option of find:

    find  -maxdepth 1 -type d -name '*foo*' -print -quit
    

提交回复
热议问题