This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin rename util doesn't parse leading dash in expression argument correctly (thinks it is an option)


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@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@ubu:/tmp/ren $ cat /etc/issue
Ubuntu 14.04.1 LTS \n \l

csabaraduly@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@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]