Skip to content

Instantly share code, notes, and snippets.

@fd00
Created January 21, 2015 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fd00/5b12da17fd9d17ea53ac to your computer and use it in GitHub Desktop.
Save fd00/5b12da17fd9d17ea53ac to your computer and use it in GitHub Desktop.
#!/bin/bash
for var in `compgen -A variable`
do
if [[ `declare -p $var` =~ "declare -a" ]]
then
x=`printf '${!%s[@]}' $var`
eval "keys=$x"
for key in $keys
do
x=`printf '${%s[%s]}' $var $key`
eval "value=$x"
echo $var[$key]=$value
done
else
echo $var=${!var}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment