On Wed, Sep 01, 2021 at 10:36:21AM +0100, David Collier wrote: > Version: > > GNU bash, version 5.0.3(1)-release (arm-unknown-linux-gnueabihf) > > Raspberry Pi using Raspbian. > > Installed from repo? > > LINENO goes backwards when run sync > > echo "================== At this point \$LINENO has correctly counted about > 2800 lines=========================test @ 2832 $LINENO" > echo "=== Running 'sync' makes bash lose a few counts from \$LINENO - in > this case about ten - no idea how to fix it. ===" > sync > echo > "========================================================================================test > @ 2835 $LINENO"
There is no plausible reason an external command (sync or any other external command) would be able to change the value of LINENO, which is an internal shell variable. Can you post a brief but complete script which demonstrates the problem? I suspect whatever issue you're seeing is caused by something else, not by the "sync" command.