cardoni
8/9/2017 - 6:57 PM

Easily Find, Sort, & Dump Environment Variables to Console

Easily Find, Sort, & Dump Environment Variables to Console

#!/usr/bin/env bash

# handy shortcut(s) to dump environment variables to console log
dumpEnvironmentVariables () {
  userInput="$1"
  if [[ $userInput ]]; then
    env | grep -E -i "$userInput" | sort | uniq
  else
    env | grep -E -i 'aws|node|nvm' | sort | uniq
  fi

}

alias dump-conf=dumpEnvironmentVariables
alias dump-configuration=dump-conf

alias dump-aws-configuration="dump-conf aws"
alias dump-node-configuration="dump-conf node"
alias dump-nvm-configuration="dump-conf nvm"