help-bash
[Top][All Lists]
Advanced

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

Re: \n displayed instead of newline


From: Leonid Isaev (ifax)
Subject: Re: \n displayed instead of newline
Date: Wed, 30 Jun 2021 14:25:00 +0000

On Wed, Jun 30, 2021 at 10:03:54AM -0400, Greg Wooledge wrote:
> > bash: warning: here-document at line 321 delimited by end-of-file (wanted 
> > `BRIEF')
> > 
> > M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM-  cat <<- "BRIEF"
> > M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM-  Searches input files 
> > for lines containing matches.
> > M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM-  $@ ARGSM-BM-  Array 
> > of all arguments.
> > M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM-  BRIEF
> > M-BM-  
> 
> You're trying to use the tab-indented variant.  Make sure each line is
> indented strictly by tabs, NOT by spaces, NOT by a combination of tabs
> and spaces.

(M-BM- are because I pipe messages to "cat -v" before editing them)

Hmm, all these work for me:
-----8<-----
I-akula-++-10:18-~-> type cat2
cat2 is a function
cat2 () 
{ 
    /usr/bin/cat -A -- "$@" | /usr/bin/sed 's/^/#cat: /'
}

I-akula-++-10:19-~-> cat2 /tmp/a.sh 
#cat: cat <<- hde$
#cat:   This is$
#cat: ^I  "$$"$
#cat: hde$
I-akula-++-10:20-~-> bash /tmp/a.sh 
  This is
  "3377"

I-akula-++-10:21-~-> cat2 /tmp/a.sh 
#cat: cat << hde$
#cat:   This is$
#cat: ^I  "$$"$
#cat: hde$
I-akula-++-10:21-~-> bash /tmp/a.sh 
  This is
          "3409"

I-akula-++-10:21-~-> cat2 /tmp/a.sh 
#cat: cat << "hde"$
#cat:   This is$
#cat: ^I  "$$"$
#cat: hde$
I-akula-++-10:22-~-> bash /tmp/a.sh 
  This is
          "$$"

I-akula-++-10:22-~-> cat2 /tmp/a.sh 
#cat: cat <<- "hde"$
#cat:   This is$
#cat: ^I  "$$"$
#cat: hde$
I-akula-++-10:22-~-> bash /tmp/a.sh 
  This is
  "$$"
----->8-----

> I don't normally recommend this one to most people, because a lot of text
> editors apparently don't handle tab indentation correctly.

Right :) Fortunately, my text editor is busybox vi...

Sincerely,

-- 
Leonid Isaev



reply via email to

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