Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: line continuation with sed



On Thu, Oct 13, 2022, at 2:25 PM, Ray Andrews wrote:
> Could there
> ever be a situation where backslash-space-newline was not logically
> reducible to backslash-newline?

Yes!  Of course there are situations where backslash-space-newline
is at the end of a line, e.g.

 $ ls filename\ ending\ with\ a\ space\ <enter>

Consider this:

 $ mkdir space-test
 $ cd space-test

 $ echo plain > a
 $ echo space > "a "
 $ echo space-newline > "a <enter>
 "<enter>

 # print hexdump of null separated filenames
 $ find -type f -print0 | od -t x1
 0000000 2e 2f 61 20 00 2e 2f 61 20 0a 00 2e 2f 61 00
 ...
 #       ^^^^^^^^^^^    ^^^^^^^^^^^^^^    ^^^^^^^^
 #       ./a<space>  ./a<space><newline>    ./a

 $ cat a*<TAB>
->
 $ cat a a\  a\ $'\n'
 plain
 space
 space-newline

 # backslash-space-newline
 $ cat a\ <enter>
 space
 # backslash-newline
 $ cat a\<enter>
 <enter>
 plain

--

To figure out "invisible" errors in a script, check it out with a
hex editor (emacs' hexl-mode, press <f4> in mc's file viewer, use
od, hexdump or hd etc.).

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt




Messages sorted by: Reverse Date, Date, Thread, Author