zakrapovic zakrapovic - 1 year ago 72
Bash Question

A command line that works in a prompt and not in a script

Here is the exact command

bcftools norm -f /path/hg19/ucsc.hg19.fasta -c s ./user1.vcf -o ../fixed/user2.vcf

When I run it in the shell directly it works fine.

When i put it into a bash script it fails

The error message comes from bcftools itself

[main] Unrecognized command.

Script is encoded in ascii:

bcftools norm -f /path/hg19/ucsc.hg19.fasta -c s ./user1.vcf -o ../fixed/user2.vcf

So bcftools accept argument when received directly from prompt but not within the script. It is like spaces from prompt and from script are not interpreted the same way

Answer Source

Is that the full error message? Usually after 'Unrecognised command' it gives which command is unrecognised. Looking at the C source:

fprintf(stderr, "[E::%s] unrecognized command '%s'\n", __func__, argv[1]); 

So there should be something inside single quotes - the argv[1] in the code.

The most common reason in web chatter for this message is that certain commands are not available in early versions of bcftools. So, do you have more than one version of bcftools installed?

Comment (above) by the OP confirms that an alias referred to an earlier version.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download