sdemurjian
sdemurjian

Reputation: 690

How to send formatted print statement to shell command line?

I have this bash script which prints out ~800 commands I would like to run on the command line:

paste abyss_names.txt abyss_quast.txt | while IFS="$(printf '\t')" read -r f1 f2
do
       printf 'python /quast-2.3/quast.py -o %s %s \n' "$f1 $f2"
done

How do I send the print output directly to the unix shell command line?

Upvotes: 1

Views: 115

Answers (2)

anubhava
anubhava

Reputation: 786291

You don't need to use printf. Just execute the command directly in the loop.

Try this script:

while IFS=$'\t' read -r f1 f2; do
       python /quast-2.3/quast.py -o "$f1" "$f2"
done < <(paste abyss_names.txt abyss_quast.txt)

Upvotes: 2

Mike Atkins
Mike Atkins

Reputation: 1591

how about:

paste abyss_names.txt abyss_quast.txt | while IFS="$(printf '\t')" read -r f1 f2
do
       $(printf 'python /quast-2.3/quast.py -o %s %s \n' "$f1 $f2")
done

Upvotes: 0

Related Questions