Hi, Not sure I'm asking this the right way but does anyone know a way to get a bash script to finish even if it fails? I'm trying to automate running a script on all the illumina R1 and R2 files in a directory, Using 1 script to batch together the pair of reads.
For R1 in *R1*.gz
do
Echo $R1
R2=`echo $R1 | sed 's/R1/R2/'`
MyPipeline.sh "$R1" "$R2"
Done
Mypipeline.sh then does denovo assembly, blasting a database to choose a reference, then mapping to that reference and creating a consensus sequence. My problem is that if the second script doesn't find a blast match it fails. The first script then doesn't move onto the next pair of raw reads. Please can anyone suggest a solution?
Thank you!
What language are your scripts written in? There could be any number of ways to do this that are largely dependent on shell interpreter features. For example, a Javascript shell script could use Promises, or Python could use the
finally
clause in an exception handling block, and so on. Feel free to add a comment, or (preferably) edit your question to include more detail about what you're doing and how you're doing it.Thanks for the reply. These are bash scripts. I've edited my post. I hope that's enough info?
You can try following code.