Data1\begin{document}3Code #!/bin/bashfunction getStart {        local START=$(awk '/begin\{document\}/{ print NR; exit }' data.tex)        echo $START}START2=$(getStart)echo $START2which returns 2 but I want 3. I change unsuccessfully the end by this answer about How can I add numbers in a bash script:START2=$((getStart+1))How can you increment a local variable in Bash script?
How to increment local variable in Bash?
bash;variable;function;arithmetic
I'm getting 2 from your code. Nevertheless, you can use the same technique for any variable or number:local start=1(( start++ ))or(( ++start ))or(( start += 1 ))or(( start = start + 1 ))or justlocal start=1echo $(( start + 1 ))etc.