help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Understanding read -r


From: Peng Yu
Subject: [Help-bash] Understanding read -r
Date: Thu, 27 Sep 2012 10:50:17 -0500

Hi,

The manual says,
       -r     Backslash  does  not  act as an escape character.  The
backslash is considered to be part of the line.  In particular, a
back-
              slash-newline pair may not be used as a line continuation.

The following example shows that "\" at the line end means line
continuation. Is this wrong? Or I misunderstand the document?

~/linux/test/gnu/bash/man/builtin/read/-d$ ./main.sh
abc\'asdf"Hello
foo"bar"''
~/linux/test/gnu/bash/man/builtin/read/-d$ cat ./main.sh
#!/usr/bin/env bash

my_var=Hello
read -r -d '' VAR <<EOF
abc\'asdf"\
$my_var
foo"bar"''
EOF

echo "$VAR"


-- 
Regards,
Peng



reply via email to

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