bug-bash
[Top][All Lists]
Advanced

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

Re: Command substitution with null bytes generates warning


From: Eric Blake
Subject: Re: Command substitution with null bytes generates warning
Date: Mon, 19 Sep 2016 12:43:31 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 09/19/2016 11:58 AM, Greg Wooledge wrote:
> On Mon, Sep 19, 2016 at 09:28:53AM -0700, L. A. Walsh wrote:
>>    If users were relying on this behavior (I know I have scripts that read
>> things from proc -- a text interface that uses \0 to display values similar
>> to MS's multi-string Values in the Windows registry.
> 
>>    Could you change it back or provide a way to suppress "kiddy-scripter"
>> seatbelts?
> 
> wooledg@wooledg:~$ x=$(< /proc/$$/cmdline)
> bash-4.4: warning: command substitution: ignored null byte in input
> wooledg@wooledg:~$ x=$(< /proc/$$/cmdline 2>/dev/null)
> wooledg@wooledg:~$ 

Or:

$ x=$(< /proc/$$/cmdline tr -d \\0)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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