Issue
I am not sure what I am doing wrong here. It seems to work properly when I use command line.
My script is pretty simple
!/bin/bash
for file in '*.bed';do
echo $file
bedtools intersect -wa -wb -a /data2/E34_uniq.bed -b $file > $file.tsv;
done
The error I get is for all the files read from the directory -
*****ERROR: Unrecognized parameter: GSM2310918_methylcall.Sample_7273.mincov10.bed *****
*****ERROR: Unrecognized parameter: GSM2310919_methylcall.Sample_7301.mincov10.bed *****
*****ERROR: Unrecognized parameter: GSM2310920_methylcall.Sample_7308.mincov10.bed *****
Solution
It should have been as
#!/bin/bash
for file in *.bed; do
echo "$file"
bedtools intersect -wa -wb -a /data2/E34_uniq.bed -b "$file" > "${file}.tsv";
done
Notice a few things here,
- Removal of the single quotes in the glob expansion
- Adding double-quotes to variable to avoid word-splitting.
- Setting proper interpreter path for the script to run
#!/bin/bash
Answered By - Inian Answer Checked By - Cary Denson (WPSolving Admin)