0

I would like to evaluate the output of a Perl script run in a bash for loop.

My Perl script get_contigs.pl outputs a single number, and I would like to delete or keep a file depending on this number. I'm trying to do this inside of an if statement as follows:

if [ $(perl get_contigs.pl file.txt) < 130 ]
  then
  rm file.txt
  fi

But it exits with the error -bash: 130: No such file or directory

When I run this script outside of the loop: perl get_contigs.pl file.txt

I get the expected output. (In this particular case the output is 110 - so I want to remove this file).

What am I doing wrong?

fugu
  • 6,417
  • 5
  • 40
  • 75

0 Answers0