Created
September 2, 2025 22:01
-
-
Save LaptopDev/1e76c60326cf63c9189e9e55800e246a to your computer and use it in GitHub Desktop.
User/session definition resolver that prints shell definitions for aliases, functions, and exported variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| showdef () { # Check if alias, function, or environment variable & print the definition | |
| if alias "$1" &> /dev/null; then # alias? | |
| alias "$1"; | |
| elif declare -f "$1" &> /dev/null; then # function? | |
| declare -f "$1"; | |
| elif [ -n "${!1}" ]; then # environment variable? (no$) | |
| echo "${!1}"; | |
| else | |
| echo "No alias, function, or environment variable found for '$1'"; | |
| fi; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: