I have a function that worked fine in bash
function cfwipe() {
local space_guid=`cf space --guid $1`
cf t -s $1
for a in `cf curl /v2/spaces/$space_guid/apps | jq -r .resources[].entity.name`; do cf delete -r -f $a; done
for a in `cf curl /v2/spaces/$space_guid/service_instances | jq -r .resources[].entity.name`; do cf ds -f $a;done
for a in `cf curl /v2/user_provided_service_instances?q=space_guid:$space_guid | jq -r .resources[].entity.name`; do cf ds -f $a;done
}
I copied the function to .zshrc file and added it to autoload
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
autoload -Uz compinit cfwipe
compinit
fi
However when I try to run it - despite starting the execution it fails and repeats in console the same line
no matches found: .resources[].entity.name
...
What is the problem? Even with spellcheck fixes it doesn't work
cfwipe() {
space_guid=$(cf space --guid "$1")
cf t -s "$1"
for a in $(cf curl /v2/spaces/"$space_guid"/apps | jq -r .resources[].entity.name); do cf delete -r -f "$a"; done
for a in $(cf curl /v2/spaces/"$space_guid"/service_instances | jq -r .resources[].entity.name); do cf ds -f "$a";done
for a in $(cf curl /v2/user_provided_service_instances?q=space_guid:"$space_guid" | jq -r .resources[].entity.name); do cf ds -f "$a";done
}