Created
February 7, 2016 05:20
-
-
Save libcrack/b5b80a7d83e085ec85bf to your computer and use it in GitHub Desktop.
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
| ### Derefence a shell variable | |
| # ~ $ deref teag | |
| # value of [teag] is: [] | |
| # ~ $ deref HOME | |
| # value of [HOME] is: [/home/libcrack] | |
| deref(){ | |
| if [ -n "$1" ]; then | |
| localvar=$(eval echo \$$1) | |
| echo "value of [${1}] is: [${localvar}]" | |
| else | |
| echo "Null parameter passed to this function" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment