From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13309 invoked by alias); 25 Dec 2016 22:47: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: X-Seq: 22279 Received: (qmail 15990 invoked from network); 25 Dec 2016 22:47:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.52):SA:0(-0.0/5.0):. Processed in 1.816052 secs); 25 Dec 2016 22:47:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: gmaghera@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.213.52 as permitted sender) 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; bh=VJQW6Grs2xRntUElmqgiWZPuOPO6MiRiXNDYv2yjcBI=; b=BHr5vi4otcL+/GYLXjE6vC7XBUViMLmpaz1Ik4mFw7WrHbDt2XT8EXlBDEwMo+2XyZ KpxqZhCDURA/HB0FAIrHH+d8ZDZtvCUKSSnYMl6mjkXnUCUB8LXUzPANCcsQEutoQqnZ FugIqBIUXa2l8wer3N0j7gU81GQ7JtBVtC1yvFJ5MKDMY6C3XzCFGbYZ7Hhj8sR8Xevu U9Ppu38f0vHvk1y4hhj1iks/865CBiRoN7od1DcC/S1EH5WE+zUnXMxzRjZgJ5IP7/5T pcy5cdqkaTn5jc7EVSuMg/HJv4U1KN4o8HfjiORpsKaoI3xlqnTDGWlDFWH2ENbFzUT2 KSsg== 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; bh=VJQW6Grs2xRntUElmqgiWZPuOPO6MiRiXNDYv2yjcBI=; b=PI0ndPvVSE0X8Ng62tztzWIXl1kIK8X2kMITx5T2pYAaK5OGDQrdnEePpfAM+npCYR VZcYe/JTUbrw/y/pdXz+RK9YCjko/3JPLV3rvO/mmH6RRuz/pO5KejJ7xCvLPSaaAcTR ti9MUFsJKcHHzZ4bMCB1QrlMi/9ODz7bmG/JC1KssAnXwrZfno0FbBkkfJnuUTgDCm61 d4SENXrL91SqZV25eTqDMzoAPbKEe+YlV8pD9V2y2hVZ4kVWl0hjoBFwYw8D7Cumr+wq IsIx7SSebb89FU//ah+ioAP6STdfbLZeLZUdSivePfwTJHas264J4ta7vGf2F1UtDpHD hmDQ== X-Gm-Message-State: AIkVDXJ6G19WVcIzo2iiqciyBsL0R3g23s8HsDGkk+lyFEdIxDHmFr9FmMQlJIITiA13jc6pjMobJshmOEEllQ== X-Received: by 10.31.225.69 with SMTP id y66mr8966152vkg.18.1482706054290; Sun, 25 Dec 2016 14:47:34 -0800 (PST) MIME-Version: 1.0 References: <161225131004.ZM26673@torch.brasslantern.com> <8789C49A-57C0-49FA-BC1A-52DCBFBF88FB@me.com> In-Reply-To: <8789C49A-57C0-49FA-BC1A-52DCBFBF88FB@me.com> From: Gabor Maghera Date: Sun, 25 Dec 2016 22:47:23 +0000 Message-ID: Subject: Re: newbie rm --^file question To: Akihiko Hohji , Bart Schaefer Cc: "zsh-users@zsh.org" Content-Type: multipart/alternative; boundary=001a114e0224ac23c60544836795 --001a114e0224ac23c60544836795 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable That "--" causes rm to stop looking for flags. It is handy if the file pattern argument supplied to rm includes '-' characters. See the man page for the rm command, it's explained towards the end. You don't really need it for what you are doing, but if you would like to use it, it is a separate argument from the file or globbing pattern: Try: rm -rf -- ^com.apple.IntlDataCache.* And here is an example where you do need to use the "--" argument: =E2=9D=AF ls -o bar.ext foo foo.ext ~/example/abc =E2=9D=AF rm -o rm: illegal option -- o usage: rm [-f | -i] [-dPRrvW] file ... unlink file ~/example/abc =E2=9D=AF rm -- -o ~/example/abc =E2=9D=AF ls bar.ext foo foo.ext ~/example/abc On Sun, Dec 25, 2016 at 1:49 PM Akihiko Hohji wrote: > Sorry. Actually extended glob was due to auto-correction by Apple Mail. > I really typed in setopt extendedglob. > > Either rm -rf with double =E2=80=9C-=E2=80=9C ^file.ext.* or a single =E2= =80=9C-=E2=80=9C does not work. > I get the same =E2=80=9Cno matches found=E2=80=9D message. And there is = no space in > between =E2=80=9C-=E2=80=9C. I=E2=80=99ve gotten this approach with the = double =E2=80=9C-=E2=80=9C from a post in > Stackoverflow. If I don=E2=80=99t add =E2=80=9C*=E2=80=9D at the end or = begging of file name, it > works fine. > > To just give you more details, the following is the list of files in > /System/Library/Caches; > > drwxr-xr-x 16 root wheel 544B Dec 16 21:53 . > drwxr-xr-x 92 root wheel 3.1K Dec 16 09:31 .. > drwxr-xr-x 6 root wheel 204B Dec 15 21:47 com.apple.CVMS > -rw-r--r-- 1 root wheel 42K Oct 4 21:52 > com.apple.Components2.SystemCache.Components > -rw-r--r-- 1 root wheel 57K Sep 13 20:49 > com.apple.Components2.SystemCache.QuickTimeComponents > -rw-r--r-- 1 root wheel 8.6K Dec 16 09:31 com.apple.IntlDataCache.le > -rw-r--r-- 1 root wheel 78K Dec 16 09:31 > com.apple.IntlDataCache.le.kbdx > -rw-r--r-- 1 root wheel 21K Dec 16 09:35 > com.apple.app-sandbox-cache.plist > -rw-r--r-- 1 root wheel 41B Dec 16 09:32 com.apple.bootefisignature > drwxr-xr-x 3 root wheel 102B Dec 15 21:36 com.apple.bootstamps > drwxr-xr-x 2 root wheel 68B Dec 15 21:36 com.apple.corestorage > drwx------ 3 root wheel 102B Dec 17 22:30 com.apple.coresymbolicatio= nd > drwxr-xr-x 4 root wheel 136B Dec 15 21:36 com.apple.kext.caches > -rw-r--r--@ 1 root wheel 23K Dec 16 21:53 > com.apple.preferencepanes.systemcache > -rw-r--r-- 1 root wheel 11K Dec 16 09:35 > com.apple.xpc.extensions.cache > -rw-r--r-- 1 root wheel 203K Dec 16 09:35 com.apple.xpchelper.cache > > I=E2=80=99d like to get rid of directories and files except > com.apple.IntlDataCche.le and com.apple.IntlDataCche.le.kbdx. > > And I did; > > setopt extendedglob > rm -rf -^com.apple.IntlDataCache.* > > Then I get zsh: no matches found: -^com.apple.IntlDataCache.le.* > > Again my system is > > sw_vers > ProductName: Mac OS X > ProductVersion: 10.12.2 > BuildVersion: 16C67 > > Thanks. > > AH > > > On Dec 25, 2016, at 4:10 PM, Bart Schaefer > wrote: > > > > On Dec 25, 7:22pm, Hoji, Akihiko wrote: > > } > > } setopt extended glob > > > > If you literally did that, you should have gotten an error message; the= re > > is no option named "extended" although there is one named "glob". > > > > You can use underscores or hyphens between words (actually, between any > > two letters) in option names, but not spaces. > > > > setopt extendedglob > > setopt extended_glob > > setopt extended-glob > > setopt EX_tend-ed_GLOB > > > > } rm -rf -^file.ext.* > > > > Is there a space missing there between the second "-" and the "^" ? Or > > do the files you want to remove really have names beginning with "-" ? > > > > } I would appreciate a poster as to what I am doing wrong. > > > > Other than misplaced spacing, you seem to have it; see Gabor's example. > > --001a114e0224ac23c60544836795--