diff --git a/expand.cpp b/expand.cpp index f927f3c0e..1d541a246 100644 --- a/expand.cpp +++ b/expand.cpp @@ -1034,7 +1034,7 @@ static int expand_variables(parser_t &parser, const wcstring &instr, std::vector { if (errors) { - parse_util_expand_variable_error(instr, 0 /* global_token_pos */, c, errors); + parse_util_expand_variable_error(instr, 0 /* global_token_pos */, i, errors); } is_ok = false; diff --git a/tests/expansion.err b/tests/expansion.err index e60c203d5..5fcc58e08 100644 --- a/tests/expansion.err +++ b/tests/expansion.err @@ -28,3 +28,6 @@ fish: echo ()[1] Invalid index value fish: echo ()[d] ^ +$) is not a valid variable in fish. +fish: echo $$paren + ^ diff --git a/tests/expansion.in b/tests/expansion.in index b43fd3bf8..2b6d93760 100644 --- a/tests/expansion.in +++ b/tests/expansion.in @@ -81,6 +81,10 @@ echo $foo[d] echo ()[1] echo ()[d] +echo "Catch your breath" +set paren ')' +echo $$paren + # Test tilde expansion # On OS X, /tmp is symlinked to /private/tmp # $PWD is our best bet for resolving it diff --git a/tests/expansion.out b/tests/expansion.out index fe594539c..9fd68a041 100644 --- a/tests/expansion.out +++ b/tests/expansion.out @@ -40,3 +40,4 @@ 0 1 0 +Catch your breath