Find path in bash on insensitive manner

前端 未结 2 1179
天涯浪人
天涯浪人 2021-01-26 09:52

Suppose a path like

/home/albfan/Projects/InSaNEWEBproJECT

Despite of the fact to not use such that names. Is there a way to check for a path

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-26 10:25

    My fault! I guess I tried

    find -ipath 'projects/insanewebproject' 
    

    but the trick here is that I must use

    find -ipath './projects/insanewebproject'
    

    That ./ does the change. Thanks!.

    man says -path is more portable than -wholename

    if you expect only one result, you can add | head -n1, cause that way head kill pipe when it fills its buffer, which is only one line length

    find -ipath './projects/insanewebproject'| head -n1
    

提交回复
热议问题