bug-bash
[Top][All Lists]
Advanced

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

Re: 4.4 change in behavior from 4.3: how to catch unset when using ${#le


From: Greg Wooledge
Subject: Re: 4.4 change in behavior from 4.3: how to catch unset when using ${#length}
Date: Mon, 24 Oct 2016 08:26:59 -0400
User-agent: Mutt/1.4.2.3i

On Fri, Oct 21, 2016 at 09:19:08PM -0700, L. A. Walsh wrote:
> Eduardo Bustamante wrote:
> >what's wrong with?:
> >echo ${#array[@]}

> Not when "-u" is set, which I often have on to help catch misspellings.
> 
> set -u
> echo ${#array[@]}
> bash: array: unbound variable

See http://mywiki.wooledge.org/BashFAQ/112

set -u is almost as bad as set -e.  It's a poorly implemented crutch
which breaks scripts that would otherwise work.

If you're going to file bug reports about your scripts breaking when
you use set -u, you should at least mention that in the initial bug
report.



reply via email to

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