help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to not to ignore null in $()?


From: Andreas Kusalananda Kähäri
Subject: Re: Is there a way to not to ignore null in $()?
Date: Mon, 11 May 2020 15:52:38 +0200

On Mon, May 11, 2020 at 07:13:54AM -0500, Peng Yu wrote:
> $ x=$(awk -e 'BEGIN{print "a\000b" }')
> -bash: warning: command substitution: ignored null byte in input
> $ declare -p x
> declare -- x="ab"
> 
> I think that there is no way to avoid the above warning as no null
> character can be in a bash variable. But if I want to avoid using a
> temp file, then I have to have to save the output in a bash variable?
> 
> Is there a good way to save some binary data in memory in bash? Thanks.
> 
> -- 
> Regards,
> Peng


data=$( printf 'a\000b\n' | base64 )


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]