Re: [RFC/PATCH] t0081-*.sh: Fix failure of the 'long read' tests

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

 



On Tue, Apr 26, 2011 at 07:05:38PM +0100, Ramsay Jones wrote:

> The infinite loop is caused by the loop variable increment
> expression, which looks something like this:
> 
>     : $((i = $i + 1)) || return
>
> [...]
>
> The reason for the RFC is that I don't understand why (apparently)
> I'm the only person seeing this failure; I suspect that a newer
> version of bash than I have does not have this problem (ie the
> original arithmetic expansion actually works). dunno :-(

Yeah, that syntax is handled just fine by my bash and dash:

  $ cat >foo.sh <<'EOF'
  i=1
  : $((i = $i + 1))
  echo $i
  EOF

  $ bash foo.sh
  2
  $ bash --version | head -n 1
  GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)

  $ dash foo.sh
  2

But I think your i=$(($i + 1)) is the right solution.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]