[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Escape Character and NewLine
From: |
Fernando Basso |
Subject: |
[Help-bash] Escape Character and NewLine |
Date: |
Mon, 16 Sep 2019 16:16:51 -0300 |
I was reading this section about the Escape Character:
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Escape-Character
I then tried two examples to test my (mis)understanding:
Example 1:
----
printf '%s\n' foo\
bar
----
And running example 1 produces what I had expected:
----
bash dev.sh
foo
bar
----
However, if I try it in an assignment operation:
Example 2:
----
str=foo\
bar
----
The output is:
----
bash dev.sh
dev.sh: line 5: bar: command not found
----
In example 2, isn't the backslash causing the \newline to be treated as a
line
continuation and being effectively ignored?
What is going on here?
- [Help-bash] Escape Character and NewLine,
Fernando Basso <=
- Re: [Help-bash] Escape Character and NewLine, Greg Wooledge, 2019/09/16
- Re: [Help-bash] Escape Character and NewLine, Fernando Basso, 2019/09/16
- Re: [Help-bash] Escape Character and NewLine, David, 2019/09/16
- Re: [Help-bash] Escape Character and NewLine, Greg Wooledge, 2019/09/17
- Re: [Help-bash] Escape Character and NewLine, Fernando Basso, 2019/09/17
- Re: [Help-bash] Escape Character and NewLine, Chet Ramey, 2019/09/17
- Re: [Help-bash] Escape Character and NewLine, Greg Wooledge, 2019/09/17
- Re: [Help-bash] Escape Character and NewLine, David, 2019/09/18
- Re: [Help-bash] Escape Character and NewLine, Fernando Basso, 2019/09/18