Redi.sh is a primitive Redis client, written entirely in Bash. It allows you to read/write keys and sets from redis as if they were regular Bash variables.
Redi.sh是原始的Redis客户端,完全用 Bash 编写。 它允许您从 Redis 读取/写入密钥和设置,就好像它们是常规的Bash变量一样。
Usage:(用法)
By default
redi.sh reads input from stdin and interprets it as a variable or array (if -a is used). To avoid setting redis hostname and port number with each command, you can export REDIS_HOST and REDIS_PORT variables.
缺省情况下,redi.sh从stdin读取输入,并将其解释为变量或数组(如果使用-a)。 为了避免在每个命令中设置redis主机名和端口号,可以导出 REDIS_HOST 和 REDIS_PORT 变量。
./redi.sh [-a] [-g <variable|array>] [-p <password>] [-H <hostname>] [-P <port>]
-a : Tells the script that we are working with arrays, instead of regular variables.
告诉脚本我们正在使用数组,而不是常规变量
-r <min,max> : When used with -a, defines the range of elements to get from the array. Default is all (0,-1).
与-a一起使用时,定义要从数组获取的元素范围。 默认为全(0,-1)。
-g <name> : Get the variable/array specified by <name> and output it to stdout.
获取<name>指定的变量/数组,并将其输出到stdout。
-s <name> : Set the variable/array specified by <name> with the input from stdin.
用stdin的输入设置<name>指定的变量/数组。
-p <password> : Use "AUTH <password>" before running the SET/GET command to authenticate to redis.
在运行SET / GET命令进行Redis身份验证之前,请使用“ AUTH <password>”。
-H <hostname> : Specify a custom hostname to connect to. Default is localhost.
指定要连接的自定义主机名。 默认值为localhost。
-d <number> : Specify a custom database number from range 0-15\. Default is 0
指定范围为0-15 \的自定义数据库编号。 默认为0
-P <port> : Specify a custom port to connect to. Default is 6379.
指定要连接的自定义端口。 默认值为6379
Example:
redi.sh -H 1.1.1.0 -p 123
报错:
./redi.sh: line 7: syntax error near unexpected token `newline'
./redi.sh: line 7: `<!DOCTYPE html>'
$ echo "this is a variable" | ./redi.sh -s testvar
$ ./redi.sh -g testvar
this is a variable
$ echo red green blue | ./redi.sh -as Colors
$ ./redi.sh -ag Colors
red
green
blue
License
MIT