LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 02-20-2008, 02:40 PM   #1
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Rep: Reputation: 15
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

Anybody notices this?
 
Old 02-20-2008, 03:02 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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").

HTH

Forrest

Last edited by forrestt; 02-20-2008 at 03:04 PM.
 
Old 02-20-2008, 03:08 PM   #3
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
Thank you. Here are all the info:

$ 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 View Post
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").

HTH

Forrest
 
Old 02-20-2008, 03:17 PM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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
 
Old 02-20-2008, 03:27 PM   #5
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
And what do you get with "ls -lad ." from within the directory holding olddir?

Forrest
 
Old 02-20-2008, 03:40 PM   #6
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by forrestt View Post
And what do you get with "ls -lad ." from within the directory holding olddir?

Forrest
drwxr-xr-x 5 root root 4096 2008-02-20 12:03 .
 
Old 02-20-2008, 04:12 PM   #7
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Well, if you are running the command as root, then it should work. If not it should give you:

mv: cannot move `newdir/' to `olddir/': Permission denied

Perhaps there was a bug in that version of coreutils. Try upgrading it and see if it goes away.

HTH

Forrest
 
Old 02-20-2008, 04:45 PM   #8
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
Even I am as root it still doesn't work with new version bash.

BTW the exact syntax works with my another machine, which has bash version:

$ bash --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.


Quote:
Originally Posted by forrestt View Post
Well, if you are running the command as root, then it should work. If not it should give you:

mv: cannot move `newdir/' to `olddir/': Permission denied

Perhaps there was a bug in that version of coreutils. Try upgrading it and see if it goes away.

HTH

Forrest
 
Old 02-20-2008, 04:48 PM   #9
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
If this is a bug, or possible bug, where can I report it?
Thanks

Quote:
Originally Posted by forrestt View Post
Well, if you are running the command as root, then it should work. If not it should give you:

mv: cannot move `newdir/' to `olddir/': Permission denied

Perhaps there was a bug in that version of coreutils. Try upgrading it and see if it goes away.

HTH

Forrest
 
Old 02-20-2008, 04:58 PM   #10
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
BTW, how to check my coreutils's version?
 
Old 02-20-2008, 05:39 PM   #11
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
What distro are you running?
 
Old 02-20-2008, 05:52 PM   #12
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Original Poster
Rep: Reputation: 15
one is debian
another is ubuntu

Quote:
Originally Posted by forrestt View Post
What distro are you running?
 
Old 02-20-2008, 06:06 PM   #13
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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.

HTH

Forrest
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
su no longer works BashTin Slackware 13 08-01-2007 10:33 PM
mount --bind olddir newdir --> anyway to do this at startup ? darkknight_9 Linux - Newbie 4 04-21-2005 06:35 PM
HP ScanJet No Longer Works shortsword Linux - Hardware 1 01-09-2005 09:17 PM
3ddesktop after apt-get upgrade no longer works with this error ... Outabux Debian 3 12-17-2004 10:59 AM
Modem no longer works infornography Linux - General 3 11-07-2003 12:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration