Error: `mv olddir/ newdir/ ` no longer works on new version of bash?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Error: `mv olddir/ newdir/ ` no longer works on new version of bash?
Suppose you have a directory called "olddir" exists but no "newdir", you want to rename "olddir" to"newdir"
In previous versions (at least in 2.05b.0) of bash, you can try
mv olddir/ newdir/
OR
mv olddir/ newdir
But in new versions of bash, if you
mv olddir/ newdir/
BASH panics:
mv: target `newdir/' is not a directory: No such file or directory
What is the output of "which mv"? I'm not getting this error from bash or tcsh. However, I suspect that mv may be what is having issues.
Code:
% bash --version
GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
% mv --version
mv (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Parker, David MacKenzie, and Jim Meyering.
Are you actually using "newdir" and "olddir"? I suspect that if you try these you won't have any issues and that the directories that you are actually using are what is causing mv to bomb (e.g. you may not be able to write to "newdir").
$ ls
drwxr-xr-x 2 root root 4096 2008-02-20 12:03 olddir
$ mv olddir/ newdir/
mv: target `newdir/' is not a directory: No such file or directory
$ which mv
/bin/mv
$ bash --version
GNU bash, version 3.2.13(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
Quote:
Originally Posted by forrestt
What is the output of "which mv"? I'm not getting this error from bash or tcsh. However, I suspect that mv may be what is having issues.
Code:
% bash --version
GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
% mv --version
mv (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Parker, David MacKenzie, and Jim Meyering.
Are you actually using "newdir" and "olddir"? I suspect that if you try these you won't have any issues and that the directories that you are actually using are what is causing mv to bomb (e.g. you may not be able to write to "newdir").
I tried those commands (exactly), and got no problems. Also tried to move a directory where I didn't have write permissions, but that clearly said that I did not have permissions, not that the file didn't exist like in the above example. So it makes me wonder..
mv is from GNU coreutils, version 6.9, bash is GNU bash, 3.2.17
I'm not a Debian/Ubuntu guru, but try "apt-get -V coreutils". The command may be different, I'm not sure. I don't have either of those distros handy to try.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.