Last active
January 27, 2019 13:52
-
-
Save xiazhibin/b2d7b17a90cc613bb100efa28d3c9dc1 to your computer and use it in GitHub Desktop.
将redis cmd转化为redis协议
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read CMD; do | |
# each command begins with *{number arguments in command}\r\n | |
XS=($CMD); printf "*${#XS[@]}\r\n" | |
# for each argument, we append ${length}\r\n{argument}\r\n | |
for X in $CMD; do printf "\$${#X}\r\n$X\r\n"; done | |
done < redis_commands.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment