bin/167288: mv can not copy files with '-' sign as first
kes-kes at yandex.ru
Wed Apr 25 19:57:08 UTC 2012
Вы писали 25 апреля 2012 г., 21:30:14:
GP> The following reply was made to PR bin/167288; it has been noted by GNATS.
GP> From: Gary Palmer <gpalmer at freebsd.org>
GP> To: Eugen Konkov <kes-kes at yandex.ru>
GP> Cc: freebsd-gnats-submit at FreeBSD.org
GP> Subject: Re: bin/167288: mv can not copy files with '-' sign as first simbol
GP> Date: Wed, 25 Apr 2012 14:25:45 -0400
GP> On Wed, Apr 25, 2012 at 10:48:23AM +0000, Eugen Konkov wrote:
>> >Number: 167288
>> >Category: bin
>> >Synopsis: mv can not copy files with '-' sign as first simbol
>> >Confidential: no
>> >Severity: non-critical
>> >Priority: low
>> >Responsible: freebsd-bugs
>> >State: open
>> >Class: sw-bug
>> >Submitter-Id: current-users
>> >Arrival-Date: Wed Apr 25 10:50:09 UTC 2012
>> >Originator: Eugen Konkov
>> >Release: 10.0-CURRENT
>> ISP FreeLine
>> uname -a
>> FreeBSD fastvpn.in.freeline.in.ua 10.0-CURRENT FreeBSD 10.0-CURRENT #2: Fri Dec 16 18:38:54 EET 2011 kes at fastvpn.in.freeline.in.ua:/usr/obj/usr/src/sys/KES_KERN_v9 i386
>> If I use glob symbol, then special symbols in file names must not be counted as special symbols
>> : > -1.wav
>> mv * /some/dir
>> mv: illegal option -- 1
>> usage: mv [-f | -i | -n] [-v] source target
>> mv [-f | -i | -n] [-v] source ... directory
GP> Standard command line protocol says that you should use -- to
GP> mark the end of command line options in this situation, so that any
GP> -<something> that comes after is not processed as an option
GP> mv -- * /some/dir
GP> Since the glob is done in the shell prior to being passed to mv as
GP> arguments, there is no way for 'mv' to know any differently.
glob work on file names. so when shell expands glob it must expand it
in right way: file names must not became options for programms
Ok, if '--' sign is a special and mark the end of command line options
echo -- hello
echoing '-- hello' instead of 'hello'??
this also does not work:
sox -c 2 -- * -c 1 ./../* -r 8000 result.wav
because '-c' will be counted as 'file name'
and what behaviour will be, if file name has ' '?
For example: Saving all file names in directory to file:
echo * > /some/file
as a result I get 'aa aa bb bb'
Which files are in current directory?
1) 'aa aa', 'bb bb'
2) 'aa' 'bb' 'aa bb'
3) your sugggestion
PS. ugly behaviour to my mind
or unclean spec/docs maybe
Eugen mailto:kes-kes at yandex.ru
More information about the freebsd-bugs