[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \n displayed instead of newline
From: |
Greg Wooledge |
Subject: |
Re: \n displayed instead of newline |
Date: |
Wed, 30 Jun 2021 09:21:48 -0400 |
On Wed, Jun 30, 2021 at 03:07:19PM +0200, lisa-asket@perso.be wrote:
> >From: Greg Wooledge <greg@wooledge.org>
> >cat <<'EOF'
> >Usage: grep -ir --exclude=\*.el --include=\*.{orig,texi} \
> >-C 8 "hilbert" /marshall/
> >EOF
>
> >Just place the entire message directly into the script, exactly as you
> >want it to be printed. (There's a tab-indented variant, if you want to
>
> >go down that road, but start with the simpler version first.)
>
>
>
> Does 'EOF' do a different thing than "EOF".
They're identical. In both cases, three of the characters of the
here-document sentinel have been quoted.
When *any* character of the here-document sentinel is quoted, no
substitutions are performed inside the here-document.
Therefore, all of the following are equivalent:
cat <<'EOF'
cat <<"EOF"
cat <<\E\O\F
cat <<\EOF
cat <<EO"F"
and so on. The only variant that is NOT equivalent is the one where zero
characters are quoted:
cat <<EOF
In that one, some substitutions (parameter expansion, command substitution,
and so on) are performed in the here-document.
In this particular example, it doesn't matter, because there aren't any
substitutions in the usage text. But I don't know how much more text
you were planning to add, so I figured I'd use the "safer" choice.
- \n displayed instead of newline, lisa-asket, 2021/06/29
- Re: \n displayed instead of newline, Jesse Hathaway, 2021/06/29
- Re: \n displayed instead of newline, Greg Wooledge, 2021/06/29
- \n displayed instead of newline, lisa-asket, 2021/06/30
- \n displayed instead of newline, lisa-asket, 2021/06/30
- Re: \n displayed instead of newline, Greg Wooledge, 2021/06/30
- \n displayed instead of newline, lisa-asket, 2021/06/30
- Re: \n displayed instead of newline,
Greg Wooledge <=
- \n displayed instead of newline, lisa-asket, 2021/06/30
- Re: \n displayed instead of newline, Greg Wooledge, 2021/06/30
- Re: \n displayed instead of newline, Leonid Isaev (ifax), 2021/06/30
- \n displayed instead of newline, lisa-asket, 2021/06/30