Hey all, I'm trying to write a small bash loop to iterate over all sam files in a directory converting them to bam. What I have so far is:
files=$(ls) for f in "$files" do samtools view -S -b $f>"$f".bam done
But what I get when I run that is:
convert_sam_to_bam.sh: line 9: ACGGTC.1.sam AGACCA.1.sam AGCTTT.1.sam AGGAAT.1.sam [list of all sams in the directory] TGACAT.1.sam TTAGGC.1.sam TTGACT.1.sam TTGTCA.1.sam.bam: File name too long
I'm sure the problem is that I'm messing up with the quotations somewhere, but I can't for the life of me figure out where. Any thoughts? Thanks a lot in advanc!