This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bash Script prints out Command

Hello,

I am new to creating bash scripts to run commands. I've tried to run this simple bash script to calculate the genome coverage of a bam file I have using the bedTools genomeCoverageBed command. I am not sure what I am doing wrong, but when I run this script I can a file that contains the printed command.

Here is my script:

#!/bin/bash
echo "This is a Test:"
BAM_FILE=/RNA-seq/TopHat_Output/WT_Rep_1_accepted_hits_sorted.bam
echo genomeCoverageBed -ibam $BAM_FILE -bg > WT_Rep_1_genomecov.bedgraph

Thank you

Rodrigo

bash genome coverage

Hello rodrigo.nicodemos82!

We believe that this post does not fit the main topic of this site. This is not a bioinformatics question sorry. You really need to do a 10 minute bash primer online.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

1 answer

You are getting the command printed out inside WT_Rep_1_genomecov.bedgraph file, right?

That is because the echo at the beginning of the line. Writing echo before the command that you want to run, actually you are printing the command itself. Remove echo and run it again.

Log in to answer this question.