[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] How not to include the trailing newline when <<< is used
From: |
Dan Douglas |
Subject: |
Re: [Help-bash] How not to include the trailing newline when <<< is used? |
Date: |
Wed, 25 May 2016 16:41:34 -0500 |
On Wed, May 25, 2016 at 1:14 PM, Greg Wooledge <address@hidden> wrote:
> On Wed, May 25, 2016 at 12:43:49PM -0500, Dan Douglas wrote:
>> On Wed, May 25, 2016 at 12:30 PM, Dan Douglas <address@hidden> wrote:
>> Er... if using head then I meant this:
>>
>> $ printf -v x %s%n $'\uE4' lx; head -c "$lx" <<<"$x"; echo " b"
>> รค b
>
> I'm pretty sure "No" was the best answer. ;-)
>
> Also, whatever that command is supposed to be, it doesn't work as
> written in bash 4.3 on HP-UX:
Getting the string length in bytes while assigning so that `head -c`
does the "right" thing - assuming you have `head -c` and it doesn't
randomly disagree with `tail -c` on measuring bytes.
> $ printf -v x %s%n $'\uE4' lx; head -c "$lx" <<<"$x"; echo " b"
> 4: No such file or directory
> b
> imadev:~$ declare -p x lx
> declare -- x="\\uE4"
> declare -- lx="4"
> ...
So your $'\uHHHH' isn't working for some reason. Was bash configured
with whatever it is that sets HANDLE_MULTIBYTE for the bit in
strtrans.c that deals with \u? config.h says it's on by default for
platforms that support it. I don't know.