
問題は、Result.txtを上書きして最後のクエリのみを取得することです。この問題をどのように解決できますか?
#!/bin/sh
while read -r line
do
echo "'$line'"
sqlplus -s whatever/whatever <<-EOF
SPOOL Result.txt
SELECT * FROM ---- WHERE sol = '$line';
SPOOL OFF ;
exit;
EOF
done < evs.txt
答え1
ただ追加してください
rm Results.txt
ループ前
そして
cat Result.txt >> Results.txt
EOF以降(および以前done
)。