allow passing arguments to read command wiht -R "args"

This commit is contained in:
john30
2016-10-15 17:51:11 +02:00
parent 16822ae94c
commit 62ea2f3213
+7 -1
View File
@@ -5,7 +5,13 @@ if [ "x$1" = "x-p" ]; then
port=$1
shift
fi
readargs=
if [ "x$1" = "x-R" ]; then
shift
readargs=$1
shift
fi
for i in `echo "f" "$@"|nc localhost $port|cut -d ' ' -f '1-2'|sed -e 's# #:#'`; do
ret=`echo "r -c" ${i%%:*} ${i##*:}|nc localhost $port|head -n 1`
ret=`echo "r ${readargs} -c" ${i%%:*} ${i##*:}|nc localhost $port|head -n 1`
echo ${i%%:*} ${i##*:} "=" $ret
done