From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 265F5287E8 for ; Tue, 21 May 2024 19:43:49 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1716313429; b=o8+I8Xd/mCt0BwyYXaJzUvSHYTnlIRyNGoNpsvs4sxb+Bvnz1OM1DnqQboXlCLtcMWZXizFFCt DhIhVeqHhmqrP+VuHne+oq9xKsGpALvqlMpJySJzKHgdup+uPP99qI16J604kDCtyLmFJvkUK/ 5Nyr/Itfd3RsqauXLmItXJtrdmSgwS41jkZKw1CukgKuuoZndNXcdWjj2LXnyvXz1qgxq9oYei Cczbzla5iPr2G/zf4E4uSGcrG9uT6hDMSVSB2tzbWR3cIYl7OPRcBoMqGIitcZ7gbdYhDB3LJD L3Y0hrwoT/pH7SjPlT3lGRhq7vKLYi7yAaoWYTjjMCTnMQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1716313429; bh=JSnpF47Jp74wMUj5GYxbQkBRvl9AlqkeGYv3pcM/pQw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Subject:From:To:MIME-Version:Date:Message-ID:Content-Type: DKIM-Signature; b=KWQBuAjd27nqo6uqEy3nsMYPLnxaGDrWk7tqR/vLcgbcbXv5zZIDgUtC7fNB/IT6wr5/ukw3Cx XVS+ENT5T2an68RPdusuAyJ70v/0jZoFwTVDAe6ZRpYZSsoNG+qICIdPYAFrsuqYJhOOsUyZHt t6mR1yoCh9n2b1ou7pUXMqpVizEZr+suk+E+ubxfuPW0NHKegSrFEYWmlbjELlWm1mIXnDjAz3 Dd0b3LPT1fXFd01U+zVh6p+iPl17y4YOBzAbPZffGjJpMlux4EmKoWtzialeIHW1rXL7Orykdg 8uO4l27Hgj2+C7bwTu5I295/0pVjk2MqDnYAhg5481P3GQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Subject:From:To:MIME-version:Date: Message-id:Content-type: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=rRBUGTyChZhFM/6dtN5zXw6AatpWq2xUCyKDwEAi/cs=; b=bXz5ZUzIcyryz9uVOgW5C4RvgT 3+nz38z3B75EXs4dTMVLWggqSZBsXvI3boSmuXjiPREMW6I7YwX7qj9AbLMOMfMo8PlKvTcpnA7Ft /EBhlJS56fNs0vwoCsZlZZVMQ2Rtu1y3NdbpAtRooK6O+pfJxfb5sJ7H1dk7t9yXLCgaXRXNYQ+hu qviB9SoBuH6J1SkLIjy67gb6pbMSek8zJToaaXxV8oZIp8Gtn15vehZiyChUYUri2eLt3wWLAurHA W/7guGvBpeuai8QFn3bEvmqj32lecj9Y3EZgRulqPa9a89b586+W8jouxyB1oLTYGz4EefuAfRh4g HgxdiXfw==; Received: by zero.zsh.org with local id 1s9TWf-000EZX-3r; Tue, 21 May 2024 17:43:49 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:35995) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s9TVh-000DoE-M7; Tue, 21 May 2024 17:42:51 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta03.eastlink.ca ([24.224.136.9]) with ESMTPS id <0SDU1TR5WJRK1ZR0@mta03.eastlink.ca> for zsh-users@zsh.org; Tue, 21 May 2024 14:42:25 -0300 (ADT) Received: from [192.168.0.15] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id 9TVIsaIvk98ni9TVIsxkZ7 (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Tue, 21 May 2024 14:42:25 -0300 X-Authority-Analysis: v=2.4 cv=C75KyhP+ c=1 sm=1 tr=0 ts=664cdd01 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=3s1fmOcFFo-eVSNHODoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=95xPcUBe_Q_6NY8O2aYA:9 a=d-E-fEm8o1I7vhPP:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeivddguddugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurheptgfkffggfgfvhffusegrtderredtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeeffeeivddtkedvgfetkeevudfhtdeltdegtedttdekieffhfeuhfekheegtdevteenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduhegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: -100 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------BBgLxNVrM7dNC3BkrLJGZDEA" Message-id: <75784205-3d78-4dd8-8474-e2eb48598307@eastlink.ca> Date: Tue, 21 May 2024 10:42:24 -0700 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Content-language: en-US To: Zsh Users From: Ray Andrews Subject: the splits X-Seq: 29959 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: This is a multi-part message in MIME format. --------------BBgLxNVrM7dNC3BkrLJGZDEA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit A function of mine might need to unmount someting.  If there's a problem I try to be helpful: umount -v "$mountpoint" || {     # Helpful diagnostics if partition won't unmount:     echo "\nCan't unmount $mountpoint.  Is a terminal logged on? Or is it one of these programs:?\n(Please wait or press '^C' to quit.)"     abc=$(lsof | grep $mountpoint)     abc=( ${(f)abc} )     for def in $abc[@]; do ghi=( ${=def} ); print -- "$ghi[1]\t$ghi[-1]\n"; done     return } Typical run: % mnt ,U sda Unmounting partitions ... umount: /mnt/sda/1: target is busy. Can't unmount /mnt/sda/1.  Is a terminal logged on?  Or is it one of these programs:? (Please wait or press '^C' to quit.) zsh      /mnt/sda/1/EFI/BOOT geany    /mnt/sda/1/EFI/BOOT geany    /mnt/sda/1/EFI/BOOT geany    /mnt/sda/1/EFI/BOOT ---------------------------------------------------- ... works fine but I'll bet: abc=$(lsof | grep $mountpoint) abc=( ${(f)abc} ) for def in $abc[@]; do ghi=( ${=def} ); print -- "$ghi[1]\t$ghi[-1]\n"; done ... is belabored.   Can that be streamlined?  As always my splitting is a problem.  I need to process line by line, but then word by word so as to grab just the first and last words from 'lsof' output.  I'll bet Roman can do all of the above in 20 characters. --------------BBgLxNVrM7dNC3BkrLJGZDEA Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit A function of mine might need to unmount someting.  If there's a problem I try to be helpful:


umount -v "$mountpoint" ||
{
    # Helpful diagnostics if partition won't unmount:
    echo "\nCan't unmount $mountpoint.  Is a terminal logged on?  Or is it one of these programs:?\n(Please wait or press '^C' to quit.)"

    abc=$(lsof | grep $mountpoint)
    abc=( ${(f)abc} )
    for def in $abc[@]; do ghi=( ${=def} ); print -- "$ghi[1]\t$ghi[-1]\n"; done
    return
}       

Typical run:


% mnt ,U sda

Unmounting partitions ...
umount: /mnt/sda/1: target is busy.

Can't unmount /mnt/sda/1.  Is a terminal logged on?  Or is it one of these programs:?
(Please wait or press '^C' to quit.)

zsh      /mnt/sda/1/EFI/BOOT
geany    /mnt/sda/1/EFI/BOOT
geany    /mnt/sda/1/EFI/BOOT
geany    /mnt/sda/1/EFI/BOOT

----------------------------------------------------

... works fine but I'll bet:

abc=$(lsof | grep $mountpoint)
abc=( ${(f)abc} )
for def in $abc[@]; do ghi=( ${=def} ); print -- "$ghi[1]\t$ghi[-1]\n"; done


... is belabored.   Can that be streamlined?  As always my splitting is a problem.  I need to process line by line, but then word by word so as to grab just the first and last words from 'lsof' output.  I'll bet Roman can do all of the above in 20 characters.


--------------BBgLxNVrM7dNC3BkrLJGZDEA--