bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Backslash handling not POSIX-compliant


From: Edward Welbourne
Subject: Re: Backslash handling not POSIX-compliant
Date: Wed, 29 Jul 2020 09:00:49 +0000

Ivan Kozlov (28 July 2020 16:18) wrote
> 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.

Putting quotes round the here-tag has the same effect as escaping it:

$ V=argle
$ cat <<EOF
> some text $V
> EOF
some text argle
$ cat <<"EOF"
> some text $V
> EOF
some text $V
$ cat <<'EOF'
> some text $V
> EOF
some text $V
$ cat <<\EOF
> some text $V
> EOF
some text $V

I find this works in both dash and bash.
Not sure how that maps out for the use within make, though.

        Eddy.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]