Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Created December 5, 2024 14:20
Show Gist options
  • Save e-minguez/492b6d70cac5f0a3c800b6b856987099 to your computer and use it in GitHub Desktop.
Save e-minguez/492b6d70cac5f0a3c800b6b856987099 to your computer and use it in GitHub Desktop.
Get the list of occurences on a word in bash running on a container.
podman run -it --rm registry.opensuse.org/opensuse/leap:latest /bin/bash -c $'
word="example"
script_content=$(cat "/proc/$$/cmdline" | xargs -0)
count=$(echo "$script_content" | grep -ow "$word" -c)
echo "${count}"
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment