I am trying to cut out the prefix from a variable that represents path.
Currently this is my code:
for f in /Users/username/Documents/Dev/beneficiary-service/src/main/helm/*
do
echo $f
if [[ $f == 'values'* ]]
then
yq d -i $f 'resources.'
fi
done
I printed $f to see its output. I expected it to be ONLY the filename, without the path (values-stg.yaml). However, this is the output:
+ echo /Users/username/Documents/Dev/beneficiary-service/src/main/helm/values-stg.yaml
/Users/username/Documents/Dev/beneficiary-service/src/main/helm/values-stg.yaml
+ [[ /Users/username/Documents/Dev/beneficiary-service/src/main/helm/values-stg.yaml == \v\a\l\u\e\s* ]]
And also, the "if" statement will never be true, because it considers values* literally as is and not as "anything that starts with values"
[[ ${f##*/} == values* ]].