In the below bash
the function execute
is started with the while true
at the end of the script. Currently, this works and processing does begin. The function panel
in bold does not get called after execute
completes, therefore the user does not get the menu selection
and the files just loop overwritten each other. That is if there are 4 files to be processed, only the first gets processed then it gets caught in a loop and overwrites and 2,3,4 never even start. It seems like panel not being called is what the issue is, but I am not sure why its not being called. The ....
are additional lines in the script. Thank you :).
Bash
execute() {
while true
do
# oldest folder stored as variable for analysis, version log created, and quality indicators matched to run
dir=/home/cmccabe/Desktop/NGS/API
find "$dir" -maxdepth 1 -mindepth 1 -type d -printf '%T+\t%P\0' | sort -rz |
while read -r -d $'\t' time && read -r -d '' filename
do
printf "The oldest folder is $filename, created on $time and analysis done using v1.7 by $USER at $(date "+%D %r")\n" >> /home/cmccabe/medex.logs/folder.log
awk -v FL="$filename" '
FNR == 1 {filenum++}
filenum==1 && index($0, FL) {
match($0, "_0*([0-9]+)/")
FNUM=substr($0,RSTART+1,RLENGTH-2)
gsub(/^0+/,"", FNUM)
}
#filenum==2 && $0 ~ FNUM".pdf$"' /home/cmccabe/s5_files/downloads/list /home/cmccabe/s5_files/pdf/pdf > /home/cmccabe/s5_files/pdf/output
break
done
...
...
...
...
panel
done
}
menu() {
while true
do
printf "\n please make a selection from the MENU \n
==================================
\t 1 gene
\t 2 test
==================================\n\n"
printf "\t Your choice: "; read menu_choice
echo "$menu_coice panel selected"
case "$menu_choice" in
1) gene ;;
2) test ;;
*) printf "\n Invalid choice."; sleep 2 ;;
esac
done
}
while true; do
read -p "Do you want to start the me?" yn
case $yn in
[Yy]* ) execute; break ;;
[Nn]* ) exit ;;
* ) echo "Please answer yes or no.";;
esac
done
panel() {
printf "Do you want to get coverage of a specific gene, genes, or panel?"; read yn
case $yn in
[Yy]* ) menu ;;
[Nn]* ) move ;;
* ) echo "Please answer yes or no.";;
esac
}