HI
Newbie to shell scripting, written a bash script loop through 100 PE files, unable to generate output. Can some one correct my code or any suggestions.
#!/bin/bash
for f1 in *_R1_sic.fastq
do
f2=${f1%%_R1.sic.fastq}"_R2.sic.fastq"
/home/cent/anaconda3/envs/shannon_env/bin/shannon_cpp shannon -k 30 -l 150 -p /home/cent/data/cat_samples/fastqgz/trim/cent1/sickle_files/$f1 /home/cent/data/cat_samples/fastqgz/trim/cent1/sickle_files/$f2 -o /home/cent/data/cat_samples/fastqgz/trim/cent1/sickle_files/$f1$f2_shan -t 5 -u 5 -g 150 -m 150G > /home/cent/data/cat_samples/fastqgz/trim/cent1/sickle_files/$f1$f2_shan_log
done
Use
echo
at start of the command/home/cent/anaconda3/envs/shannon_env/bin/shannon_cpp shannon
to make sure command lines look ok. If not you should get an idea of what needs to be changed.A better option is to grab sample names by doing:
Remove echo after checking the function.
However, your output directory and logs will have unnecessarily long names. Assuming that base name of the files is unique, you can try this:
Remove echo for execution after checking the function.
I suggest you to use parallel for this kind of work.
It not working. : No such file or directory I give all the input files. If I run interactively it works.