Created
May 11, 2016 19:20
-
-
Save ddunkin/0c6e67a855e0c66d23ad39253346b868 to your computer and use it in GitHub Desktop.
create bash associative array of redis info
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
declare -A redisInfo | |
getRedisInfo() { | |
eval $(redis-cli INFO | tr -d '\r' | egrep -v '^(#.*)?$' | sed -E 's/^([^:]*):(.*)$/redisInfo[\1]="\2"/') | |
} | |
# example use: getRedisInfo ; echo ${redisInfo[redis_version]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment