[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read \000?
From: |
Grisha Levit |
Subject: |
Re: How to read \000? |
Date: |
Wed, 15 May 2024 16:22:08 -0400 |
On Wed, May 15, 2024 at 3:22 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi,
>
> $ echo -ne '\000a' | { read -N 1 x; declare -p x ; }
> declare -- x="a"
>
> read just skip \000 and read the next char "a". What if I want to read
> the underlying character, in this case, it is \000, then x should be
> just an empty string.
>
> Can this be achieved somehow in bash?
LC_ALL=C IFS= read -r -d '' -n 1 VAR
if $? is 0 and $VAR is empty, a null byte has been read
- How to read \000?, Peng Yu, 2024/05/15
- Re: How to read \000?, alex xmb sw ratchev, 2024/05/15
- Re: How to read \000?, Peng Yu, 2024/05/15
- Re: How to read \000?, Jeffrey Walton, 2024/05/15
- Re: How to read \000?, Greg Wooledge, 2024/05/15
- Re: How to read \000?, Jeffrey Walton, 2024/05/15
- Re: How to read \000?, Koichi Murase, 2024/05/15
- Re: How to read \000?, Greg Wooledge, 2024/05/15
Re: How to read \000?,
Grisha Levit <=