[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: renameutils 0.6.0
From: |
Bob Proulx |
Subject: |
Re: renameutils 0.6.0 |
Date: |
Wed, 10 Aug 2005 21:27:03 -0600 |
User-agent: |
Mutt/1.5.9i |
Brian Hall wrote:
> (cc: to bug-coreutils in case this is a coreutils problem)
I did not see anything in your posting that looked like a coreutils
problem.
> We have talked about this before, but I have never been able to get imv
> to work without patching it to change the order of the arguments passed
> to "mv". icp has the same issue. qmv works fine.
What is "imv"?
> The order of the arguments passed my imv doesn't work:
>
> > strace imv setup-gentoo-chroot
> execve("/usr/bin/mv", ["mv", "setup-gentoo-chroot", "--",
> "setup-gentoo-chroot.sh"], [/* 68 vars */]) = 0
You have word wrapped that line in sending it. I am sure you meant to
have it all on one line as in the following, right?
execve("/usr/bin/mv", ["mv", "setup-gentoo-chroot", "--",
"setup-gentoo-chroot.sh"], [/* 68 vars */]) = 0
That is clearly the wrong ordering.
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
Yep.
> Adding a leading "\" to the mv command, or specifying the path doesn't
> help:
>
> > \mv setup-gentoo-chroot -- setup-gentoo-chroot.sh
To avoid an alias you can quote the command on the command line.
Quoting can take various forms. One is \command. Another is
'command'. Yet another is "command". If a comman is quoted then no
alias expansion will be done by Bourne-like shells.
But nothing you have shown me looks like an alias problem. Aliases
are expanded at the command line. But you apparently have a program
which is running the commands from an exec(2) call. This will not be
in a path that expands aliases. I think our pursuit of aliases as a
problem here is just a red herring throwing you off of the scent of
the real problem.
> This order works:
>
> > mv -- setup-gentoo-chroot.sh setup-gentoo-chroot
That looks perfectly reasonable.
> as does this (which I think was your intent):
>
> > mv -v -- setup-gentoo-chroot setup-gentoo-chroot.sh
> `setup-gentoo-chroot' -> `setup-gentoo-chroot.sh'
Perfectly reasonable.
Pass the verbose -v option to mv. Pass -- specifying that there are
no more options. This protects against filenames that start with a
dash. Otherwise you may be moving a file that starts with a dash it
it would look like an option. So specifying -- is a good safe way to
avoid confusing tools that filename arguments might be an option to
the command.
touch -- -a-file-with-dashes
ls -ldog -- -a-file-with-dashes
rm -- -a-file-with-dashes
> The man page for mv simply says that "--" should "terminate the option
> list". Hmmm. I guess it expects "--" to occur as the last NON-FILE
> argument?
Yes. That is standard behavior. See the standards documentation for
more information.
http://www.opengroup.org/onlinepubs/009695399/utilities/mv.html
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
> If so, puttting it in between the file arguments is the source
> of the problem. Do you have a reference that says something like
>
> mv name1 -- name2
>
> is legal syntax?
It's not. Unless name2, the last argument, is a directory and both
"name1" and "--" are files to be moved there. But who would name a
file "--"? Of course stranger things have happened. Looks like a
simple bug.
Bob