From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id ab25c5dc for ; Fri, 21 Jun 2019 00:05:55 +0000 (UTC) Received: (qmail 10273 invoked by alias); 21 Jun 2019 00:05:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23975 Received: (qmail 17264 invoked by uid 1010); 21 Jun 2019 00:05:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr1-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25482. spamassassin: 3.4.2. Clear:RC:0(209.85.221.46):SA:0(-2.0/5.0):. Processed in 1.481649 secs); 21 Jun 2019 00:05:44 -0000 X-Envelope-From: luomat@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.221.46 as permitted sender) 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=PlGRsFtCt6XXN93WeK1tyzug2kSlckAm5iQ3TK8Ni0E=; b=khHAnBbvCyosLxsBJIlBfP0xUSdpvr5vcNB7fhcYN+cgb64/9j8iobR1LZwCOwa7AJ EZDT5tKk2N1KrmPQqjapiqHVNBo1+p0jFgl/zq5P0w91hPlOBmPQuujsPY9Ipd8eumdC vEc89wK2UXmJx4SQWUCQPbk+TrHCyF58GPvTNqMCdvQ+UWcr47Ak6b3TqmF4yU0Edg+M wMERIWzxWJZD2SzELQ9DesylXn1FzRKIztXhENrfrWG7RykzNTb9d4SvdSrrT+YOMqqb pg/4ccFtUXi54ypMcaaNPz77Soc4aZw7emjzgPQIo1Hq/ZpKB3iTC5jAB7nlE1hd6NCo s8CQ== 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=PlGRsFtCt6XXN93WeK1tyzug2kSlckAm5iQ3TK8Ni0E=; b=CUBhyWwXhTGFbcJ/ZCY0P1x/KTAkiHWm14+T7yry8LEE5rRPQYWPL+p8C+yFHDphLc y+eTMNgG3qQVR3IE41vFPgHwDdjl5xxUc56VSVWSnsYYpPp+1bDCDIrJoDXYSsL7gCGg /hjcefIQH880TteoWMyiweIqZcfll0CA+H7NTChVWhpzsM5OWVLNitrvgZKhGZ6I+oG9 zkgdutphxBUHdqNCTflf2zzxSIDwbayIiyraVmt1t7n4iVBIxlslWKgAa3vkJvd+3CFV WEdsgago61xmzeOZXqQuxo+bA0xsSH3LoRdS6DzrGooXg432l8Zb0y/xrZkJ6JT0gSZ2 u6ww== X-Gm-Message-State: APjAAAVHm+j/D1HQ+qDM3/9klqVt8AKxLiBvaS5AJpaT5p1DdYd12gvi Sekc4WxMOhnMYucqirAAwKzgyGg9EirpqK9uWsiHZ8mb5Gc= X-Google-Smtp-Source: APXvYqzVDHcwfp6DLu8kZGZeju0uYiserOPiirs2kwXyyBnmgPBdYkhEi/bexN3yAKvAvFqU369PkWwRkaoqQBxRYgc= X-Received: by 2002:adf:c541:: with SMTP id s1mr78266336wrf.44.1561075508520; Thu, 20 Jun 2019 17:05:08 -0700 (PDT) MIME-Version: 1.0 From: TJ Luoma Date: Thu, 20 Jun 2019 20:04:32 -0400 Message-ID: Subject: how to either ignore or deal with Icon$'\r' files on macOS To: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" I never thought I'd hate anything more than the .DS_Store files that macOS makes, but it turns out there's something much worse: Icon$'\r' These are some kind of file that is uses to give a special icon to a folder when viewed in the Finder, but the files themselves aren't visible in Finder (why they didn't make them '.icon' files, I have no idea). Most of the time I can just ignore them, but I've run into one folder where I need to be able to do something like for i in * do whatever done but I do NOT want to do whatever if "$i" is one of these stupid Icon$'\r' files. The problem is that I can't figure out how to match it. for i in * do if [ "$i" != "Icon$'\r'" ] then echo "$i" fi done doesn't work. It will echo "Icon" without the last character(s). I don't even know what to try to match, because it shows up as that weird "$'\r'" thing, but not if I do `ls` % /bin/ls -l Icon$'\r' -rw-rw-rw-@ 1 luomat staff 0 Jun 20 18:42 Icon? and if I run `ls` through `cat -v` I get this: % /bin/ls -l | fgrep -i icon | cat -v -rw-rw-rw-@ 1 luomat staff 0 Jun 20 18:42 Icon^M I don't even know how to `rm` it reliably and safely, and macOS will just re-generate it anyway, so it felt like it was time to figure out how to properly ignore it. Any suggestions welcome. Tj -- TJ Luoma TJ @ MacStories Personal Website: luo.ma (aka RhymesWithDiploma.com) Twitter: @tjluoma