[英]BASH script running two commands
我正在尝试使脚本运行额外的命令。
我的原始脚本:
#!/bin/bash
UTIL=/opt/dcm4che-5.11.0/bin
INPUT=/opt/notes/cs1fill/2017/missing_cs1
suid=/opt/notes/cs1fill/2017/0020000D/suid.txt
cnt=0
START=1
count=$START
END=25000
awk -v S=$START -v E=$END 'NR>=S&&NR<=E {print $1}' $INPUT | while read input1 #starting at a certain row
do
echo "Row $count" | tee -a rowcount25k.txt
((cnt++))
echo "Moving :" ${input1}
$UTIL/findscu -c STORESCP@10.0.0.1:104 -m 00080050=${input1} -r0020000D --out-dir /opt/notes/cs1fill/2017/0020000D --out-file suid.txt
$UTIL/movescu -c STORESCP@10.0.0.1:104 -m 0020000D=${suid1} --dest cs1FIR
((count++))
if (( cnt == 50 )); then
echo "Sleeping for 5 Seconds on $(date), I have moved $count exams"
sleep 5
cnt=0
fi
exec 0<$3 #Restore old stdin.
done
echo "Counter:" $((count-START)) # Show moved items
第一个命令将从input1(带有一列的数字列表)中读取,并将写入名为“ suid.txt”的文件。
第二个命令将从文件suid.txt中读取以执行最后一个任务。
我的问题是,运行“ findscu”的第一个命令将覆盖“ suid.txt”而不是添加到其中,因此我需要第二条命令来完成其任务,然后返回到第一条命令,直到完成从中读取“ input1”。
任何帮助与赞赏
这是关于findscu的。 该程序具有默认覆盖文件,而不是添加到文件末尾。 这对于所有可能将输出重定向到文件的程序都是正常的。
例如,tee具有特殊参数,请勿覆盖:
-a Append the output to the files rather than overwriting them.
我不知道这个程序,但是如果您不给--out-directory和--out-file参数,那么输出是到stdout吗? 尝试这个:
$UTIL/findscu -c STORESCP@10.0.0.1:104 -m 00080050=${input1} >> /opt/notes/cs1fill/2017/0020000D/suid.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.