bug-bash
[Top][All Lists]
Advanced

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

Re: Tilde is expanded in $PATH, inconsistent behavior


From: Greg Wooledge
Subject: Re: Tilde is expanded in $PATH, inconsistent behavior
Date: Thu, 23 Jan 2025 21:21:46 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Jan 23, 2025 at 18:15:38 -0800, Keith Thompson wrote:
> $[...] appears to behave like $((...)).  Is it equivalent?

It was the proposed syntax for arithmetic in a POSIX draft a couple
decades ago.  Bash implemented it, and it started to catch on.  But
then POSIX went with $(( )) instead.  $[ was deprecated years ago,
and removed from the manuals, but it's still there for compatibility
with scripts that were written when it was still a supported syntax.

I actually wish $[ had won the battle, because $( and $(( have some
parsing ambiguities that crop up from time to time.



reply via email to

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