How to know whether a unix command execution is successful

856 views Asked by At

I recently tried a bcftools command (to handle variant files) in my command line.

The command that I tried is given below

bcftools merge --force-samples -O z -o final.vcf.gz ethn.vcf.gz

However, the command was working but took a long time to merge. So, I let the system on overnight to let it run.

However, while I woke up, I see that the system is shut down due to power exhaustion

How can I know whether my last command in Unix/Linux terminal is successful?

The above command shown was just an example. You can even explain me how to check that with a simple gzip operation.

Though I do see the final.vcf.gz I can't say that the command is successful because as soon as the command starts running, I see this file being generated. So, I can't rely on that

Any help please?

1

There are 1 answers

0
loremdipso On BEST ANSWER

If it's a one-liner you can also try writing to a file, like:

bcftools merge --force-samples -O z -o final.vcf.gz ethn.vcf.gz && date > done.txt