0
我有以下腳本:爲什麼我無法將bash輸出存儲到shell中?
#!/bin/bash
…code setting array ids, etc…
for i in "${!ids[@]}" ; do
echo "#${ids[i]}_${pos[i]}_${wild[i]}_${sub[i]}"
curl -sS "http://www.uniprot.org/uniprot/"${ids[i]}".fasta";
done |
sed '/^>/ d' |
sed -r 's/[#]+/>/g' |
perl -npe 'chomp if ($.!=1 && !s/^>/\n>/)' > $id.pph.fasta
但是結果不會存儲在文件中。我可以這樣做的結果輸出到文件中的終端和存儲:
./myscript > result.txt
不過,我想這樣做的腳本和輸出之內環路以外的文件。
您正在寫'$ id.pph.fasta'。什麼是'$ id'? –
看起來$ $ id在你的腳本中是未定義的,在這種情況下,你的管道的輸出將轉到'.pph.fasta'(一個隱藏的文件)。 –