注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。
启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
Redis supports mass insert via redis-cli --pipe
, but commands need to be written in redis protocol. For more details, check out the Redis mass insertion page. This script takes care of converting ordinary redis commands to redis protocol.
#!/usr/bin/env 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
#!/bin/bash | |
# | |
# License: MIT | |
# Author: Michael Weibel | |
# | |
gen_redis_protocol() { | |
cmd=$1 | |
proto="" | |
proto+="*" | |
ALL | |
All messages in the mailbox; the default initial key for | |
ANDing. | |
ANSWERED | |
Messages with the \Answered flag set. | |
BCC | |
Messages that contain the specified string in the envelope | |
structure's BCC field. |