On Thu, Jan 26, 2017 at 01:11:25PM -0800, L A Walsh wrote: >> Subject: Re: What is correct syntax to check for empty array?
The number of elements is 0 if the array is empty. So you would test whether ${#array[@]} is 0. > > set -u # now add an undefined check Now you've changed the question. You're no longer asking whether an array is empty. You're asking whether some legacy crap from 197x will make your shell script abort. Answer: who the hell cares. Stop doing it.