1

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?

2 Answers 2

2

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)
Sign up to request clarification or add additional context in comments.

3 Comments

python /quast-2.3/quast.py -o file1 /path/to/file1, where file1 is from abyss_names.txt and the path is from abyss_quast.txt
Then python /quast-2.3/quast.py -o "$f1" "$f2" should have worked right?
Ah, it does work. Sorry about that. Thanks for your patience
0

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

1 Comment

$(...) is not needed as it will fork a sub-shell for every line in the loop and pipe after paste can also be avoided.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.