[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Transform strings with special characters so that the st
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted? |
Date: |
Mon, 30 Mar 2015 07:55:45 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Mar 29, 2015 at 10:41:53AM +0100, Stephane Chazelas wrote:
> ksh93 doesn't need a -v because it doesn't fork+pipe in
> var=$(printf %s "$var") (and that output will never end in a
> newline character).
The fact that you lose the newline is, in my opinion, a pretty strong
endorsement for having printf -v var.
arc3:~$ ksh
h:w$ foo='newline
> '
h:w$ bar=$(printf %s "$foo")
h:w$ echo "<$bar>"
<newline>
With Bash-style printf -v bar %s "$foo" the content would have been
copied properly.
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, (continued)
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Eduardo A . Bustamante López, 2015/03/24
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Eric Blake, 2015/03/25
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Eric Blake, 2015/03/25
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Chet Ramey, 2015/03/26
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Eric Blake, 2015/03/26
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/29
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?,
Greg Wooledge <=
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/30
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Greg Wooledge, 2015/03/30
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/30
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Greg Wooledge, 2015/03/30
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/30
- Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/29
Re: [Help-bash] Transform strings with special characters so that the strings don't need to be quoted?, Stephane Chazelas, 2015/03/25