redish/lib/net.sh

20 lines
207 B
Bash
Raw Normal View History

2020-05-02 19:34:34 +00:00
###
# redis sock
###
exec {sock}<>/dev/tcp/"$host"/"$port"
###
# net wrappers
###
redis_send() {
printf %s "$@" >&"$sock"
}
2020-05-02 20:36:49 +00:00
redis_recv() {
if (( $# )); then
IFS= read -rt 5 "$1" <&"$sock"
fi
}