这是我在shell中的代码,并且包含python命令:
for file in `ls $FOLDER`
do
echo "$file"
var=`python -c "from Bio import SeqIO, SeqUtils; import os; rec = SeqIO.read("**$FOLDER/$file**", 'fasta'); SeqUtils.xGC_skew(rec.seq, 220000)" `
done
而且我不知道如何使python识别我的文件名
您需要在python代码中转义双引号:
for file in `ls $FOLDER`
do
echo "$file"
var=`python -c "from Bio import SeqIO, SeqUtils; import os; rec = SeqIO.read(\"$FOLDER/$file\", 'fasta'); SeqUtils.xGC_skew(rec.seq, 220000)" `
done
我看到一些常见的shell错误:
ls
。采用ls
for file in "$FOLDER"/*; ...
而不是$(...)
-易于阅读,易于嵌套。 `...`
PATH=something
。