LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2013, 07:31 AM   #1
shyamr
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Rep: Reputation: Disabled
MV command error


Hi all,

I'm trying to use the mv command in my shell.
But when i execute the shell, /r gets appended to my directory and the file name(file name is input).tried using /$'\r'/ .but still face the same issue.

Please help

Thanks
Shyam
 
Old 07-21-2013, 07:47 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi and welcome to LQ!

Quote:
Originally Posted by shyamr View Post
I'm trying to use the mv command in my shell.
But when i execute the shell, /r gets appended to my directory and the file name(file name is input).tried using /$'\r'/ .but still face the same issue.
Please show us the exact command you used and tell us what you are expecting the mv command to do.
 
Old 07-21-2013, 07:55 AM   #3
shyamr
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Below is the part of the shell
-----------------------------
#Declaration of directory path
LV_DATA_PATH="$NCBC_TOP/ncbc_swift" # NCBC_TOP is defined to the directory i need
LV_PARAM_PART21=`echo $LV_PARAM_PART2|awk -F"\" \"" '{print $1}'`
LV_PARAM_PART22=`echo $LV_PARAM_PART2|awk -F"\" \"" '{print $2}'`
LV_PARAM_PART23=`echo $LV_PARAM_PART2|awk -F"\" \"" '{print $3}'`
LV_FILE_NAME="${LV_PARAM_PART22/$'\r'/}"
echo $LV_FILE_NAME
echo $LV_DATA_PATH
mv $LV_DATA_PATH"/"$LV_FILE_NAME $LV_DATA_PATH"/"swift_ready"/"$LV_FILE_NAME

below is the output and error
-----------------------------
o5300142.out

/oracle/ebssit/a01/apps/apps_st/appl/ncbc/12.0.0/ncbc_swift

mv: cannot stat `/oracle/ebssit/a01/apps/apps_st/appl/ncbc/12.0.0/ncbc_swift\r/o5300142.out\r': No such file or directory
 
Old 07-21-2013, 08:14 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,421

Rep: Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815Reputation: 2815
Well first off, this would appear to be a script and not working directly in the shell.

As for the error, which now makes more sense, you have created the file in windows and then run it in linux. Issue is that windows uses \r\n for line endings
and hence any variable being set now has \r at the end of it.

Try running dos2unix over the script first and see how you go.
 
  


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
[SOLVED] run ps|grep command by script/command line ... ERROR: Unsupported option (BSD syntax) masuch Programming 4 05-23-2012 05:13 AM
Find command with standard error output and mail error file montblanc Programming 2 11-11-2010 10:06 PM
Hylafax Problem (MODEM Command error) (FCS error) derekalan18 Linux - Server 2 11-08-2009 09:54 PM
Unable to compile C++ programs.make:g++ command not found error.Error 127 PrathuD Programming 3 03-16-2009 01:44 PM
My error in mkisofs command to make a command line iso mg92865 Linux - Newbie 1 06-20-2008 12:43 PM


All times are GMT -5. The time now is 05:33 PM.

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