[英]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.