help-bash
[Top][All Lists]
Advanced

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

Re: checking whether an array `excl` is set


From: Greg Wooledge
Subject: Re: checking whether an array `excl` is set
Date: Mon, 26 Jul 2021 07:55:34 -0400

On Mon, Jul 26, 2021 at 05:27:25AM +0200, dora-solomon@brusseler.com wrote:
> On Mon, Jul 26, 2021 at 04:50:27AM +0200, dora-solomon@brusseler.com wrote:
> >> Could I check whether an array `excl` is set using the command
> >> if [[ -v excl ]]; then
> 
> I am making the array if a specific option to a function is specified by the 
> user.

So you have zero need to "check" whether the array is "set".  The only
thing you need to check is the "specific option", whatever that is.

local excl=()
while [[ $1 ]]; do
  case $1 in
    specific) excl=(stuff);;
    ...
  esac
  shift
done



reply via email to

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