[フレーム]
Last Updated: March 23, 2017
·
247
· ruiwen

Bash function to translate redis commands to their pipelined equivalent

Bash function to translate redis commands to their pipelined equivalent
eg.

$ redis_p HMSET key value key1 value1
*5
5ドル
HMSET
3ドル
key
5ドル
value
4ドル
key1
6ドル
value1
$
function redis_p() {
 declare ARR=(${@:-$(</dev/stdin)})
 OUTPUT="*${#ARR[@]}\r\n"
 for a in "${ARR[@]}"; do
 OUTPUT+="\$${#a}\r\n${a}\r\n"
 done
 echo -ne $"${OUTPUT}"
}```

AltStyle によって変換されたページ (->オリジナル) /