diff --git a/create-linode.sh b/create-linode.sh index 9dafcbd..9b88bad 100755 --- a/create-linode.sh +++ b/create-linode.sh @@ -151,7 +151,7 @@ if [[ "$SCRIPT_ACTION" == "l" ]]; then fi # Destroy -if [[ "$SCRIPT_ACTION" == "d" ]]; then +if [[ "$SCRIPT_ACTION" == "d" && -n "$LINODE_LABEL" ]]; then INSTANCE_IP=$(curl -s -H "Authorization: Bearer $LINODE_API_KEY" https://api.linode.com/v4/linode/instances | jq '.data[] | select(.label == "'$LINODE_LABEL'") | .ipv4[]' | sed -e "s/\"//g") INSTANCE_ID=$(curl -s -H "Authorization: Bearer $LINODE_API_KEY" https://api.linode.com/v4/linode/instances | jq '.data[] | select(.label == "'$LINODE_LABEL'") | .id' | sed -e "s/\"//g") echo "Destroying ID:$INSTANCE_ID Hit Ctrl-C in the next 10 seconds to cancel."