[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Backslash handling not POSIX-compliant
From: |
Ivan Kozlov |
Subject: |
Re: Backslash handling not POSIX-compliant |
Date: |
Tue, 28 Jul 2020 17:18:09 +0300 |
My test case is actually wrong. The standard output would be the same in both
cases.
Here is a proper test case:
>.POSIX:
>test:
> A=\\
> echo $$A
The expected result is
>\
being written to the standard output. The actual result is an empty line being
written.
Another example is:
>.POSIX:
>test:
> echo "a \\
> b"
Which fails instead of printing
>a \
>b
The expected behaviour is useful because it allows portably quoting macros with
here-documents, for example:
> sed '$s:\\$::' <<\end; : \\
> $V\
> end
should print the literal value of the macro $V that can contain single quotes
and special characters. I believe there is no other way to achieve this with
POSIX make.