| ▲ | chubot 3 hours ago | |
FWIW Oils has an option to prevent the ambiguity:
It really should be
That is an unambiguous program that works in every shell. In a well-written shell program, the only things that should follow a single backslash in a double quoted string are
(Although I found that this option is only on in ysh, not in shopt --set strict:all ... arguably that should be changed)Nine Reasons to Use OSH - https://oils.pub/osh.html | ||
| ▲ | dzaima 2 hours ago | parent | next [-] | |
That seems to be be an entirely-different question - `echo "c:\\new"` still differs in behavior between bash and dash - dash parses backslashes in both the double-quoted string, and then echo does another backslash parsing pass, still printing a newline; whereas bash prints a backslash + n. | ||
| ▲ | gaigalas 2 hours ago | parent | prev [-] | |
yash also has something similar, ECHO_STYLE var. https://magicant.github.io/yash/doc/_echo.html Additionally, the ksh family has `print`, which solves some of the issues. And the story repeats all over again, each shell solving the problem in a different way :) That's one of the main reasons I went for solving the portability problem from the scripting side, not the interpreter side. | ||