ls -al charts/**/*[^values,^Chart].yaml
The above command is supposed to list all the yaml files inside charts folder except values.yaml and chart.yaml.
When I try this command in mac it works fine but not in bash i.e linux terminal. Is there any way to do the same in bash?
CodePudding user response:
You could use find
for it:
find charts/ \! -name values.yaml -a \! -name Chart.yaml
CodePudding user response:
Zsh
in MacOS and bash
have different syntax. Would you please try:
shopt -s globstar extglob
ls -al charts/**/!(*values|*Chart).yaml
The shopt
command in the 1st line enables the extended pattern matching option in bash. You can put the command in the beginning of the script.
CodePudding user response:
When you say "regular expression", you say grep
:-)
I would advise you the following:
find charts/ -name "*.yaml" | grep -v "values.yaml" | grep -v "chart.yaml"
The -v
switch filters out the results.