Skip to content

Instantly share code, notes, and snippets.

@rdmarsh
Last active June 8, 2021 01:25
Show Gist options
  • Save rdmarsh/f6a55bc33fd0e0783926d61cad7f7b54 to your computer and use it in GitHub Desktop.
Save rdmarsh/f6a55bc33fd0e0783926d61cad7f7b54 to your computer and use it in GitHub Desktop.
iterates over zabbix groups going to each higher parent lever
zc/one/two/three/four
zc/one/two/three
zc/one/two
zc/one
#!/usr/local/bin/bash
set -eu
group="zc/one/two/three/four"
while [[ "${group}" == *"/"* ]] ; do
echo "${group}"
group="${group%/*}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment