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

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

It says:

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
  • 3
    Too much $ for once :) drop the $ from for $i...
    – Jeff Schaller
    Jan 1 '16 at 19:41

Pass them on the command line and reference them with $1, $2, etc, in your script.


You should change for $i in {ls*.fastq} # trying to run batch processing to for i in {ls*.fastq} # trying to run batch processing, because by using $i when declaring the loop, bash replaced $i with a blank space, as you hadn't previously assigned it a value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.