On 09/04/2014 04:17 AM, Marco Atzeri wrote: >>> >>> you need to tell rename that the options are ended with -- >>> >>> $ rename -- '-fixed' '' *-fixed.flac >>> >>> $ ls *flac >>> a.flac b.flac >> >> thanx for the tip, haven't had to use that since old days of "startx >> clientopts -- serveropts &" >> >> but yet again I'm roped with having to wrap another case statement >> around pieces of scripts for cygwin specific items (because the same >> syntax of "rename --" doesn't work on redhat linux or another distro a >> friend tried for me)
Then that particular version of rename is broken. But the bug is in that Linux distro, and you still don't have a cygwin problem. > > curious because it is the almost standard (gnu) solution in > most of the utilities. Not just GNU, but POSIX. POSIX requires that most standardized apps (all except for a few special-cased oldies like echo) interpret -- as the end of options, EVEN when such apps don't have any standardized options (for example, POSIX does not require 'basename' to support any options, yet it requires 'basename -- a' and 'basename a' to behave identically). POSIX also recommends that all (non-standard) apps also honor this convention, and makes it quite easy to do so - any app built on top of the standardized getopt() (or the GNU extension getopt_long) will automatically handle -- correctly. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html Guideline 10: The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character. The utilities in the Shell and Utilities volume of POSIX.1-2008 that claim conformance to these guidelines shall conform completely to these guidelines as if these guidelines contained the term "shall" instead of "should". It is recommended that all future utilities and applications use these guidelines to enhance user portability. The fact that some historical utilities could not be changed (to avoid breaking existing applications) should not deter this future goal. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature