Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no
From:
Pranav Deshpande
Subject:
Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument
Date:
Sun, 4 Jun 2017 01:45:42 +0530
Hello,
Sorry for the late reply.
My solution is to change *line 294* of builtins/read.def.
Change
if (code == 0 || *intval < 0* || intval != (int)intval)
to
if (code == 0 || i*ntval <= 0* || intval != (int)intval)
Command:
./bash -c 'read -n0 <<< "abc";declare -p REPLY'
Output:
./bash: line 0: read: 0: invalid number
./bash: line 0: declare: REPLY: not found
i.e. behaviour #1.
Is this solution ok?
Regards,
Pranav