I want to write bash scripts that are as self-documentary as possible.
I had an idea that when I execute software with lots of flags, I wanted to split the command into multiple lines, and add a comment at the end of each line, telling what the flag does (info from a man page), like so:
bwa aln \ -n $n \ # -n max #diff (integer) or missing prob under 0.02 err rate (float) [0.04] -o $o \ # -o maximum number or fraction of gap opens  -e $e \ # -e maximum number of gap extensions, -1 for disabling long gaps [-1] -i $i \ # -i do not put an indel within integer bp towards the ends  -d $d \ # -d maximum occurrences for extending a long deletion  -l $l \ # -l seed length  -k $k \ # -k maximum differences in the seed  -m $m \ # -m maximum entries in the queue  -t $t \ # -t number of threads  -M $M \ # -M mismatch penalty  -O $O \ # -O gap open penalty  -E $E \ # -E gap extension penalty  -R $R \ # -R stop searching when there are >integer equally best hits  -q $q \ # -q quality threshold for read trimming down to 35bp  -f $f \ # -f file to write output to instead of stdout -B $B \ # -B length of barcode -L $L \ # -L log-scaled gap penalty for long deletions -N $N \ # -N non-iterative mode: search for all n-difference hits (slooow) -I $I \ # -I the input is in the Illumina 1.3+ FASTQ-like format -b $b \ # -b the input read file is in the BAM format -0 $0 \ # -0 use single-end reads only (effective with -b) -1 $1 \ # -1 use the 1st read in a pair (effective with -b) -2 $2 \ # -2 use the 2nd read in a pair (effective with -b) -Y $Y \ # -Y filter Casava-filtered sequences -prefix $prefix \ # -prefix Prefix -inputfile $inputfile \ # -inputfile Input file (FastQ format)
The problem is that I can not have anything after the \ character (that tells bash that the command continues on next line), and neither can I have the "\" at the end of the line, because then it is treated as part of the comment.
Anybody knows a way to do this, or something similar?