Skip to content

Instantly share code, notes, and snippets.

@ddunkin
Created May 11, 2016 19:20
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 ddunkin/0c6e67a855e0c66d23ad39253346b868 to your computer and use it in GitHub Desktop.
Save ddunkin/0c6e67a855e0c66d23ad39253346b868 to your computer and use it in GitHub Desktop.
create bash associative array of redis info
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