X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; q=dns; s=default; b=sb 9B3MYSLvSMNHoiNNtygR+huDW3J6LJkQZCCJjGcs46cT1vIh5SYKyIohRRqrPpm8 RLV1qup7r6vkOIKUGpR6XdRaIPsJ2DpoCu9fWTbOHvudqamUGyhwKWl04YCVycpR vacOajbd2wxou9KLV5hHOeKoFej3oNEVa5BM3FOsY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; s=default; bh=3EWuwxdC 2QrIYBqUUVUABUkGw8o=; b=xGaofVPMDG/C9/m0dtdUPLzKp/CKUzScw+bbKCeu zru80SbfxV0MJd8dEQa8PcnbeYQehGmO3/NszbxntjafEZG7DG3oLEg+e08bZfJe WlOr7E0TiFHuYI3Y9Zgfo8FmCevR2RZAeHbiLIihIyHIfyGmLqJSK44gO9Is7Wz9 BNM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f52.google.com MIME-Version: 1.0 X-Received: by 10.180.73.115 with SMTP id k19mr3893575wiv.35.1409820695502; Thu, 04 Sep 2014 01:51:35 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Sep 2014 10:51:35 +0200 Message-ID: Subject: Re: cygwin rename util doesn't parse leading dash in expression argument correctly (thinks it is an option) From: Csaba Raduly To: cygwin list Content-Type: text/plain; charset=ISO-8859-1 Hi On Tue, Sep 2, 2014 at 4:43 PM, Dat Head wrote: > Cygwin 1.7.30-1 > > $ ls -l *-fixed.flac > -rw-r--r-- 1 foo None 0 Sep 1 13:47 a-fixed.flac > -rw-r--r-- 1 foo None 0 Sep 1 13:47 b-fixed.flac > > $ rename '-fixed' '' *-fixed.flac > rename: unknown option -- f > > Usage: > rename [options] expression replacement file... > > Options: > -v, --verbose explain what is being done > -V, --version output version information and exit > -h, --help display this help and exit This is not a Cygwin problem. Unix tools usually interpret an argument starting with a dash as options: csabaraduly AT ubu:/tmp/ren $ uname -a Linux ubu 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux csabaraduly AT ubu:/tmp/ren $ cat /etc/issue Ubuntu 14.04.1 LTS \n \l csabaraduly AT ubu:/tmp/ren $ ls -l *-fixed.flac -rw-rw-r-- 1 csabaraduly csabaraduly 0 Sep 4 10:42 a-fixed.flac -rw-rw-r-- 1 csabaraduly csabaraduly 0 Sep 4 10:42 b-fixed.flac csabaraduly AT ubu:/tmp/ren $ rename '-fixed' '' *-fixed.flac Unknown option: i Unknown option: x Unknown option: e Unknown option: d Usage: rename [-v] [-n] [-f] perlexpr [filenames] Marco already showed how to stop an argument with a leading dash from being treated as options. Csaba -- GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ The Tao of math: The numbers you can count are not the real numbers. Life is complex, with real and imaginary parts. "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds "People disagree with me. I just ignore them." -- Linus Torvalds -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple