Case-insensitive Glob on zsh/bash

前端 未结 5 484
日久生厌
日久生厌 2020-12-16 09:11

I need to list all files whose names start with \'SomeLongString\'. But the case of \'SomeLongString\' can vary. How?

I am using zsh, but a bash solution is also wel

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 09:51

    Depending on how deep you want to have this listing, find offers quite a lot in this regard:

    find . -iname 'SomeLongString*' -maxdepth 1
    

    This will only give you the files in the current directory. Important here is the -iname parameter instead of -name.

提交回复
热议问题