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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2378 invoked from network); 2 Nov 2020 11:26: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:26:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1604316364; b=VL45JKiyGnm4t7FYFlMND4Z6WVvDixgx8W6rrdG22HmoBceKgxIic5t2XHXqQnG7VHNnKNqMNP FqkoH0x70fw/ajMBoU7R4YJ+p5o008HeHXtck7yBpm2A9wsCdbbRGM4lzHfrsSXCGx+fF5384x BM4VpXYAb2bd/0kHgB7JnAuXQu4HQ1mvYrZYqxbGXoBfOKiPLtBkYKWXozmZkkfiXe3ZGQ5wt1 m02KQTX34uEuBtY/fI1GyGZI4A22z6s5lyxkQdhjD/1YtCG24PU7mvoWKFvIZLOMq2vhnEAs+o DEKd602lburNDyknfrgcc3i2ECmt81kxwsQWWsZs+72Dvw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f52.google.com) smtp.remote-ip=209.85.166.52; 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=1604316364; bh=cYruLt6I+hXtUyr7aENvD+qZGlkgDTIuqVmFSvvtHfY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=xY+NmbHLmeYunqml8aZgthYBZha1QPASYbfr7zxW4+x6Bw87SAvPmNUmeBRM1wOY3pxJKFcQQN VtL8KNv2OxSV1d/zKy8QCiu8+rllge90uTvaUPn3PdxwFElNVSi9KH24Uh0NK8wfuinqkNULj9 zqEp+4bhee++VVV8BFMRF3Ys2M4xnxeOgYdosU3fM+Atju/BoHkhwE0BqfYOs3FgxNghZnymi9 Q39eQOf/C/Yg0bQ6PQU8nCsgub+7z69k6y1ziAemVuQLIhgKYT0+pE2P+aKtoQpxUDU2kEJhL5 7c3U3kPj8dxmPXhYrw3AoTU0iI7EWJdwbim+dU99RmsqFg==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=WUVnb/OWMzti/v3Uv0ilpUr/LwL7rCvSp/FhFSpnVjg=; b=hpMHTdUcfZyo41tYnOPYuNf+Wc cIPO3g/AHjV0/48ihhEOEG+pOXUhN//v8iipHR3TltLJahGJL8N7xwqMk5SxF2BBaLAfEoh1NN52I yh0HmeutxLSKGRbcOXxG0YLuXAgHG2XpWMSXClLaSqOcgozi9mrX4Slm060idGGSueqS8ueGy9pFp hkiq+iuYMmB072s4IYSfk0wONYXO/jzyrwuVp0o6XxBEyt8T9ST668pEM8lpXwaohD3njKM/ODG6H MlapET6Oo/W9CamriYmgTwU56c9SBv6fM1yVVWc39BT2HxyjFK7bfGaArm5BZqaSa2CzSg78MCF2M O5z3DktA==; Received: from authenticated user by zero.zsh.org with local id 1kZXyM-000CKX-Rx; Mon, 02 Nov 2020 11:26:02 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f52.google.com) smtp.remote-ip=209.85.166.52; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f52.google.com ([209.85.166.52]:33832) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kZXxu-000ByN-7d; Mon, 02 Nov 2020 11:25:34 +0000 Received: by mail-io1-f52.google.com with SMTP id s10so283183ioe.1 for ; Mon, 02 Nov 2020 03:25:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WUVnb/OWMzti/v3Uv0ilpUr/LwL7rCvSp/FhFSpnVjg=; b=pqaZ1x0jncUk8AZ21VXO5nqf4vk/N9jlP5cP/X0qOoA88Dd9VOZCov7OLtN86EJ1uM 3JgAdBzErXbTaNiFxxt1O000vZThOD3dq6EMtNtX+0oyr0kzfSzf4RJXBh45Z3MvRlcg r9KmdFo3bo6ZbqsR4KT+cbbne/7eA/MiTPxlFnXQVF3erLlspXgThXCLEBQzYYBVatVx 4lFjBzQBVid9dQ90MTQ8iY3FQfUvW9p789wHQ1gTUA/MiRgeL3cY7KjfSDEoQAy6AbN5 gGSAeE8TZhbgulju/LQVDDllu4Xa0B/tbhbJVKZBhA6jEtU+zAZhhET3pPFQtbwte9Zh Zaqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WUVnb/OWMzti/v3Uv0ilpUr/LwL7rCvSp/FhFSpnVjg=; b=UY1F9PoFxt4rAJtbUY0IdDNJ1CNSkgpATxVzggvvy+9KVp9PauRJSu+fm+AOubdKcI dpgAu7CZtBpJKW/aj91hWrRpDF2DwivwH4CIFDlrzJkaXQZrFCBWWy2DybBdUk9Dyife 06+TGCGxrhI3uEvWpP60GCa5jxZH4bagNLGWsF8hNpQcYx8l2HWevftjVvS63c4oy1EL QHJpabcp6LChiUqTtYe/9YD6kC57RL7pXjI9Nt/2cJ0wKCZTWOLAn6ubUyx31n3GVgUx YjjfkuWjcYWi5uxuoEXjs+vmPCe/LggWFY44/oqs2EVRcqjpj1h6afX86ZM9roA+AvxO 5vOA== X-Gm-Message-State: AOAM5300UxFnrJwQGqgrTuiVNMsfJA/VgxW2zi0ac4WqwnnZSnarSqIj L5v11Y7UQA70YpShlW1sKOfSbf+t2/3MqVa9jNg= X-Google-Smtp-Source: ABdhPJyIHb8k7peX/eD3irntxe9Wj3p+VYYs7T4eYlKGUxEa4lST87VScyOeBryXeZUYyrNpW0ww/nNo5Yg3xvJz+DE= X-Received: by 2002:a02:82c5:: with SMTP id u5mr10665186jag.68.1604316332764; Mon, 02 Nov 2020 03:25:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Mon, 2 Nov 2020 12:25:21 +0100 Message-ID: Subject: Re: Removing an element from an array To: =?UTF-8?B?UGV0ZXIgU2zDrcW+aWs=?= Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 26144 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: On Mon, Nov 2, 2020 at 12:11 PM Peter Sl=C3=AD=C5=BEik wrote: > > I would like to remove an element from an array - actually a path from th= e $path variable. After some googling, I've discovered the ${array:|excl} s= yntax. > > Here is my code: > > excl=3D($path_to_remove) > export path=3D${path:|excl} This is pretty close. Here's the correct syntax: excl=3D($path_to_remove) path=3D(${path:|excl}) However, if you want to remove just one element, there is a simpler way: path=3D(${path:#$path_to_remove}) Roman.