Skip to content

Instantly share code, notes, and snippets.

@UnnaturalTwilight
Created February 24, 2026 02:00
Show Gist options
  • Select an option

  • Save UnnaturalTwilight/05921ce7d3b427443e49e3e476d88606 to your computer and use it in GitHub Desktop.

Select an option

Save UnnaturalTwilight/05921ce7d3b427443e49e3e476d88606 to your computer and use it in GitHub Desktop.
Formated printing of environment variables
#!/bin/sh
# simlink this file into PATH with a name like 'echoenv' or smth
printenv |
sort | grep "^$1" --ignore-case |
bat --no-paging --style=grid,numbers
# replace above line with cat to make more portable
# print PATH
if [[ -z "$1" || "$1" = "PATH" || "$1" = "path" ]]; then
echo " │ PATH:"
printenv PATH | sed "s/:/\n/g" |
bat --no-paging --style=grid,numbers
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment