From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 834 invoked from network); 2 Nov 2020 11:12:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Nov 2020 11:12:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1604315524; b=cg+qsCXdBNxU9TpQXGxFmf39Emq5ap4RUKLD08nP0tjcthmIyceIfS7nD7rKmmaWoKlnfXqAY2 hDptnrdslUGB+h4jOCsJF8hsilRkIrGkGjcbddGx2Xsa9mIiY2BYGdXY0QzMPP6l378bosJlEk EPhFdgujlgftX2C9SDCDMyUboEU5Mlixgc46R1WTYuv1khKjqyIDBQFjyFy8uoEAwzZpV3KSSf qPlNfm7bJWrZ/7MSG9uD+Odzl6PXv/yK+jXf5oScu6fwDbgyDsmonHxs0S20YzqUIWA2xbFeSB f2bxXV/KD46cZy9l6wzC2Q71SXma1FIoQadOmyuX3NgOzg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1604315524; bh=NT6qWqyP24+eQXLT1VxV3t7P5N47KOqZucv7LKgP9Y4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=rDdXTeADn1Du9MFYU9KyVIxVOWjMuN43CIZJzJpy0kPH5ROuHo6yMqq9FSiat8TkVHu8bujLDf jieqRoBDLwa5czR67oAzph5+Z2kt2zPIwpYgqSs3OKkI1jVP75aySiuaNZGRm4+sheOjFt/AL+ /A4EW2W1ZO2Ky7/K1CIch2DHFeHx6zmmIDggAEVdw0ut9A7F4O9S//3meWYLXW/Q9TCyJX0fau uo5RJcfYLd8+S6Q71QlG8R1XmZA6Kvr9xhYwWNh9rj0qM6danS6PxIFNEGGjfq8bD+XaNB6ENB fxqCsz0iPH7ExhvlKs8sTEVc2WRHaqXEvLDtC0hvXW+6hA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=tPTzXFBwcSPzo+WrNfXoZc7YUj870j0b6FHJGy/3lqE=; b=GtSPv55MIDQqMJEbf13kibxtlj cpV9IavdNtuXFOZzOEylWw/3duWt6TOO8RORlVEefbDWHCULJQLuxtSAkpcUSa+yWiZN/fAEqEGuh BqisisOLxVcub/ZYzOLcCRyFF9PYjvCJ2QEzkQS9UzvKNeYJkpn8dy4W7L4hQuwCgZI0/0S8sUM8W sPbunhZulNk0o7m5d5BRsuZAxIdfAQei0kbZ+etH7qP0jU/LGHQ6+LERRUWjs7JLXNCULdMl6+LNb H/P7x1vhxjUx1xYig/YqvrsfMj9iiNhBmXXnUB+V0ppnDoweS80EHot/Yy9njLpsyarJnw7c/S3nk EZekMMGg==; Received: from authenticated user by zero.zsh.org with local id 1kZXkp-000BSF-QR; Mon, 02 Nov 2020 11:12:03 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ej1-f43.google.com ([209.85.218.43]:41137) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kZXkH-000B5d-5K; Mon, 02 Nov 2020 11:11:31 +0000 Received: by mail-ej1-f43.google.com with SMTP id cw8so4781256ejb.8 for ; Mon, 02 Nov 2020 03:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=tPTzXFBwcSPzo+WrNfXoZc7YUj870j0b6FHJGy/3lqE=; b=FLQYO+IT8au6Ffhc4lYU8h4xERaPduRtCS2ZnPSF38PH1qdeMlTZF6u7Z1w03o07XO v/6RBmbgzGsNW+YwUqWNdaOVtWHTwcJfcU9T1pCeUUEDBcxNzYdMoZpVhQBZJ7GER4I4 yOLkuv5bAnS50SlHHIcRAemOSAAtHoOTn7Pk1Jvayki5O1RIqu5kHVcd923IsBWrxaiT tkcqpKX9dNcEWsh2g64kSZjQrkeN20fU/AebH1In3JaHcgHZgrS7MyHYaCOz7Etp3c0j tJb/iFKoveEXIpOuoDSGiEkG4kY1zNNjQX/TkhqgS9NCKGz1hRBid9Ybkl6g86PAt4Ma B4xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tPTzXFBwcSPzo+WrNfXoZc7YUj870j0b6FHJGy/3lqE=; b=dM1/x1rh+fvvB1GC0JCxv8PjT2Mf4CCZVk8iyYIxfBmlhvbZVzIb/+LzM3xcJrTLae seDo0Hdtv2ETR6aAsT/UIJQKrJAuU/EswjK40m60Dm+m5hHIHg5cU8sOoN/wk7Cbu3ix LtLwDpowrCwagEIJDQ+q2YmRO27usLrNsAutnmB1N/VexhwLzcjEJ2EhXDrECh+m5vj7 6YJcmOWG4olwvPMGZ1U2jN3te0orKoUoVZ67UEvY5xlVJXdrvdVY1hQZvD4Y2ftsGO2v uTUfa5aGbk40k3X9LTbUfn3GIIqylECawyUEbXdAlZ/YGCWZdJXugQS32gUJN3Prcu8X t6oA== X-Gm-Message-State: AOAM530gLoMHbw+VzxEzeX1z8GCIlq1eu/qvGgywcIWcA2qEjB3ta+bc +nYCiNcx1wcm5pGnlApPsZQWQfC00IilrVF7k/zwv9a98+X7CpCp X-Google-Smtp-Source: ABdhPJwbgbyLW++YtuCPzT3cwWmiB35EscRzFVp/BEN1AS0hULHQ4LsC+ACET1JCmfSwjQnAvbt1QdTeihgW5U1ZJio= X-Received: by 2002:a17:906:2850:: with SMTP id s16mr15305634ejc.276.1604315488270; Mon, 02 Nov 2020 03:11:28 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?B?UGV0ZXIgU2zDrcW+aWs=?= Date: Mon, 2 Nov 2020 12:11:12 +0100 Message-ID: Subject: Removing an element from an array To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000c9582905b31dcec6" X-Seq: 26143 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --000000000000c9582905b31dcec6 Content-Type: text/plain; charset="UTF-8" Hello, I would like to remove an element from an array - actually a path from the $path variable. After some googling, I've discovered the ${array:|excl} syntax. Here is my code: excl=($path_to_remove) echo "path type: ${(t)path} # -> path type: array-tied-export-special export path=${path:|excl} # -> export:19: path: inconsistent type for assignment What am I doing wrong? Actually, as the command ends up with an exception, I'm not able to verify whether 'path' is an array or a scalar after the command. This is the relevant part of the documentation. I don't think any of the conditions in the second sentence is relevant to the error message. ${name:|arrayname} If arrayname is the name (N.B., not contents) of an array variable, then any elements contained in arrayname are removed from the substitution of name. If the substitution is scalar, either because name is a scalar variable or the expression is quoted, the elements of arrayname are instead tested against the entire expression Any suggestions? Peter --000000000000c9582905b31dcec6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hell= o,

I would like to remove an element from an array= - actually a path from the $path variable. After some googling, I've d= iscovered the ${array:|excl} syntax.

Here is my code:

excl=3D($path_to_remove)
echo "path typ= e: ${(t)path}
# -> path type: array-tied-export-special
export path=3D${path:|excl}
# -> export:19: path: i= nconsistent type for assignment

What am I doing wrong? Ac= tually, as the command ends up with an exception, I'm not able to verif= y whether 'path' is an array or a scalar after the command.

This is the relevant part of the documentation.= I don't think any of the conditions in the second sentence is relevant= to the error message.

${name:|arrayname}

If arrayname is the name (N.B., not contents) of an array variable, then any elements contained in arrayname are removed from the substitution of name. If the substitution is scalar, either because name is a scalar variable or the expression is quoted, the elements of arrayname are instead tested against the entire expression

Any suggestions?
Pet= er
--000000000000c9582905b31dcec6--