help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] unset all elements but not the whole array


From: David
Subject: Re: [Help-bash] unset all elements but not the whole array
Date: Tue, 6 Aug 2019 13:49:20 +1000

On Tue, 6 Aug 2019 at 13:23, Peng Yu <address@hidden> wrote:
>
> I don't see an easy way to unset all elements but not the whole array.
> In the following example, I still want the variable x be accessible.
> Is it possible with one command? Thanks.
>
> $ declare -a x=(a b c)
> $ unset x
> $ declare -p x
> -bash: declare: x: not found

$ declare -a x=(a b c)
$ x=( )
$ declare -p x
declare -a x=()



reply via email to

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