I have a command I want to run on all of the files of a folder, and the command\'s syntax looks like this:
tophat -o
Alternative to anubhava's concise solution,
d=$(dirname path/to/sample1.fastq) b=$(basename path/to/sample1.fastq .fastq) echo $d/$b.fastq path/to/sample1.fastq tophat -o "$d/$b.fastq" "$f"