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 welcome.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ZSH:
Or, if you don’t want to enable case-insensitive globbing in general, you can activate it for only the varying part:
This will match any file that starts with ‘somelongstring’ (in any combination of lower/upper case). The case-insensitive flag applies for everything between the parentheses and can be used multiple times. Read the manual
zshexpn(1)for more information.UPDATE Almost forgot, you have to enable extendend globbing for this to work: