Having trouble with redis-cli. I wanna check if the connection to redis is refused (server down), through BASH.
Simple test
#!/bin/bash
test=$(redis-cli exit) #exit out of the "not connected console"
if [[ -z $test ]] ; then
echo "I'm empty :("
fi
I would expect Could not connect to Redis at 127.0.0.1:6379: Connection refused to be stored in $test, but this text is output to the console instead.
I'm not sure whats going on. Anyone have any ideas?
(Ubuntu 14.04.1)