redish/lib/net.sh

20 lines
207 B
Bash

###
# redis sock
###
exec {sock}<>/dev/tcp/"$host"/"$port"
###
# net wrappers
###
redis_send() {
printf %s "$@" >&"$sock"
}
redis_recv() {
if (( $# )); then
IFS= read -rt 5 "$1" <&"$sock"
fi
}