Hi, eveyone,
In a perl script, I want to test if blast was installed using the following lines. However on a computer without BLAST, there is no error message shown. What's wrong with the script? Thank you very much!
check_blast();
sub check_blast {
(open (my $BLAST, "blastn -h |")) || print STDERR "ERROR: blast not installed";
close $BLAST;
}
Thanks a lot, Siva, your comment is helpful. Can I ask you one more thing: why you add the number
2
afterblastn -h
? what's the number mean? THANKS!It's UNIX redirection.
<
is used to denote input (a file to replace STDIN),1>
(or just>
) denotes output (a file to replace STDOUT) and2>
denotes error output (a file to replace STDERR).Here, Siva asks the shell to run the command
blastn -h
and redirect any error messages to a file called error.txt.Thanks, RamRS, your comment is very helpful.
You're most welcome :)