#!/bin/bash
if [ "$#" -lt 1 ]
then
echo "Usage: $0 [filename] [host] [port]"
exit 1
fi
filename=${1}
host=${2}
port=${3}
while read line
do
echo $line | redis-cli -h $2 -p $3 -c
sleep 0.005
done < $filename
使用方式
sh import.sh bitfield_commands.txt 127.0.0.1 8888
如果需要输出日志到文本
sh import.sh bitfield_commands.txt 127.0.0.1 8888 > import.log 2>&1