For loop - mkdir and command
1
0
Entering edit mode
3.0 years ago
jellila • 0

Hi all. I am trying to write a for loop in bash. The goal is to create a directory with the same name of the input file for the command and use it as output folder for the same command. I came up with this:

for i in *.fasta; do mkdir /Users/laura/bio/insilicoseq/$i; iss generate --draft /Users/laura/bio/Assemblies/fasta/*.fasta --model miseq --output /Users/laura/bio/insilicoseq/${i} --cpus 8 --n_reads 1267000; done

the directory is created but the iss generate command saves the output in the 'insilicoseq' folder.

Could anyone help me please?

Thanks,
Laura

bash • 747 views
ADD COMMENT
0
Entering edit mode
3.0 years ago
5heikki 11k

Perhaps:

for F in *.fasta; do 
    mkdir /Users/laura/bio/insilicoseq/$(basename "$F" .fasta)
    iss generate \
        --draft "$F" \
        --model miseq \
        --output /Users/laura/bio/insilicoseq/$(basename "$F" .fasta) \
        --cpus 8 \
        --n_reads 1267000
done
ADD COMMENT

Login before adding your answer.

Traffic: 2433 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6