쉘 스크립트를 호출할 때 매개변수를 어떻게 전달합니까?

쉘 스크립트를 호출할 때 매개변수를 어떻게 전달합니까?
#!/bin/bash

./bbmap.sh ref=ref.fa # creating index file from the input  

for $i in {ls*.fastq} # trying to run batch processing 
do
    ./bbmap.sh in=$i out={.}
done

그것은 말한다:

BBMap version 35.74
Retaining first best site only for ambiguous mappings.
No output file.
NOTE:   Ignoring reference file because it already appears to have been processed.
NOTE:   If you wish to regenerate the index, please manually delete ref/genome/1/summary.txt
Set genome to 1

Loaded Reference:   3.390 seconds.
Loading index for chunk 1-2, build 1
Generated Index:    1.011 seconds.
No reads to process; quitting.

Total time:         4.443 seconds.
TestScript.sh: line 6: `$i': not a valid identifier

답변1

명령줄에 전달하고 등을 사용하여 스크립트에서 $1참조합니다 .$2

답변2

for $i in {ls*.fastq} # trying to run batch processing루프를 선언할 때 bash를 사용하면 for i in {ls*.fastq} # trying to run batch processing이전에 값을 할당하지 않았기 때문에 공백으로 대체되기 때문에 으로 변경해야 합니다 .$i$i

관련 정보