[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set $'\001'; v=$* converted $'\001' to $'\001\001'
From: |
Greg Wooledge |
Subject: |
Re: set $'\001'; v=$* converted $'\001' to $'\001\001' |
Date: |
Mon, 15 Jan 2018 08:34:55 -0500 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Mon, Jan 15, 2018 at 02:26:19PM +0800, Clark Wang wrote:
> See following example:
>
> [STEP 100] # echo $BASH_VERSION
> 4.4.12(4)-release
> [STEP 101] # set -- $'\001'
> [STEP 102] # v=$*
> [STEP 103] # printf '%q\n' "$v"
> $'\001\001'
> [STEP 104] #
Confirmed (with default IFS; it is important to note that). And also
for the record, v="$*" gives the expected result.
wooledg:~$ v="$*"
wooledg:~$ printf '%q\n' "$v"
$'\001'
Just another case of "never ever EVER use unquoted $* or $@", for us
script writers. Chet may still choose to address it as a bash bug,
of course.