Michael
Michael

Reputation: 766

bash: How to place variable into specific string

I have the following command in a bash script:

$prefixBioAwk -c fastx '{ if(length($seq) > 600) { print ">"$name; print $seq }}' my.fasta > short.fasta

Now I want to make the number 600 flexible by inserting the var $myVar (which contains an iteger) there.

How do I do it?

Upvotes: 0

Views: 76

Answers (1)

Eric
Eric

Reputation: 1521

Since this is posted as a bash question, I'm answering with a bash response rather than something bioawk specific:

myVar=600 prefixBioAwk -c fastx '{ if(length($seq) > '$myVar') { print ">"$name; print $seq }}' my.fasta > short.fasta

The key is to get out of the single quotes so that the shell can interpret the variable and substitute its value.

Upvotes: 1

Related Questions