Skip to content

Commit

Permalink
Fix to work in bash version 5
Browse files Browse the repository at this point in the history
In previous Bash versions, one could use a `continue` command in the
root scope of a function, if that function was always called inside
a loop (`for`, `while`, etc.). In that case, the `continue` would be
applied in the loop that called the function.

It does not work in bash5 anymore, so I've moved the `continue`
outside of the function.

Thanks Yanmarshus Bachtiar for the bug report and the patch.
  • Loading branch information
aureliojargas committed Mar 21, 2020
1 parent 0dba41f commit 190906c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions txt2regex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,6 @@ Menu(){
;;
esac
done

# 0,3,4: escape status
[ "${STATUS/[Z34]/}" ] || continue
}

doNextHist(){
Expand Down Expand Up @@ -1201,13 +1198,15 @@ do
Reset
TopTitle
Menu S0_txt
[ "${STATUS/[Z34]/}" ] || continue # 0,3,4: escape status
HUMAN="$S0_txt ${S0_txt[$REPLY]}"
showRegEx S0
STATUS=1
;;
1)
TopTitle
Menu S1_txt
[ "${STATUS/[Z34]/}" ] || continue # 0,3,4: escape status
if [ "${REPLY/[1-9]/}" ]
then
HUMAN="$HUMAN $REPLY"
Expand Down Expand Up @@ -1273,6 +1272,7 @@ do
2)
TopTitle
Menu S2_txt
[ "${STATUS/[Z34]/}" ] || continue # 0,3,4: escape status
rep_middle=$"repeated"
rep_txt="${S2_txt[$REPLY]}"
rep_txtend=$"times"
Expand Down

0 comments on commit 190906c

Please sign in to comment.