Hey, What happens: When an alias definition includes line continuation, at the global scope for each such line continuation the value of LINENO is off by one, effectively incremented twice. Regular newlines in alias definitions do not appear to cause any inaccuracies.
What I expected: For LINENO to be an accurate reflection of literal file lines as measured by `wc -l`. ######################### ~ $ cat ./repeater.sh #!/bin/bash -x shopt -s expand_aliases [ "$LINENO" = 3 ] || exit 3 alias reg-lines=': one : two : three' [ "$LINENO" = 7 ] || exit 7 : run alias "reg-lines". reg-lines [ "$LINENO" = 10 ] || exit 10 alias w-line-continuation=': abc \ defg \ hijkl' [ "$LINENO" = 14 ] || exit 14 : run alias "w-line-continuation". w-line-continuation [ "$LINENO" = 17 ] || exit 17 echo "Line 18, tests passed." exit 0 ######################### ~ $ ./repeater.sh + shopt -s expand_aliases + '[' 3 = 3 ']' + alias $'reg-lines=: one\n : two\n : three' + '[' 7 = 7 ']' + : run alias reg-lines. + : one + : two + : three + '[' 10 = 10 ']' + alias $'w-line-continuation=: abc \\\n defg \\\n hijkl' + '[' 14 = 14 ']' + : run alias w-line-continuation. + : abc defg hijkl + '[' 19 = 17 ']' + exit 17 ~ $ ######################### I realize that using aliases in scripts is frowned upon. Use case: Error messages with line numbers Cheers, Wiley