When I start to wander into the weeds of POSIX shell, I come across some wacky stuff. Today's find: Backslash-escaped newlines (used for breaking up a command over multiple lines) are discarded entirely when parsing a line. That means any token that is split using a backslash-escaped newline, if there is no other whitespace present, is reassembled into a single token by the shell.

If your shell is POSIX-compliant (most are), you can see this effect for yourself. Running

is equivalent to running

because the shell removes the newline and combines "l" and "s" into a single token.

Posted in: s/Linux

🚀 jsreed5

Apr 20 · 2 weeks ago · 👍 ghost, ainent

1 Comment

🥬 lamb-duh · Apr 20 at 19:37:

the use case for this is to break up a long string that should not have space inserted in it: