You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to print \ as the last character in a string literal, but compiler errors out with "Unclosed string literal".
This happens when I try to escape backslash with another backslash, no matter how many times. All of the following commands will fail to compile:
echo "Hi \\"
echo "Hi \\\"
echo "Hi \\\\"
But if you close them with another double quote, then it ignores the first quote, but starts another multiline string with the second one, and does something weird:
echo "Hi \\""
echo "Hi \\\""
echo "Hi \\\\""
Result:
Hi \
echo Hi \
Hi \"
The text was updated successfully, but these errors were encountered:
Ph0enixKM
changed the title
Cannot escape backslash in string literal, if it is the last character
[Bug] Cannot escape backslash in string literal, if it is the last character
Jul 7, 2024
Trying to print
\
as the last character in a string literal, but compiler errors out with "Unclosed string literal".This happens when I try to escape backslash with another backslash, no matter how many times. All of the following commands will fail to compile:
But if you close them with another double quote, then it ignores the first quote, but starts another multiline string with the second one, and does something weird:
Result:
The text was updated successfully, but these errors were encountered: