visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Operating Systems :: Unix :: using mv in shell scripts


By: roe1and Great Britain  Date: 18/02/2008 15:31:04  English  Points: 20 Status: Answered
Quality : Excellent
i came across this today at work while trying to rename files using a shell script. we run a mixed win/unix operation here which is probably not ideal, anyway. the file being renamed is just a text file but it has a .tab extension. when you double click these they open in an application called textpad. if i run a shell script over these to rename them windows won't automatically open them in textpad anymore. the script file is called do.txt and all it is is:

mv 1234.tab 1234_u.tab

any ideas?
By: VGR Date: 19/02/2008 07:40:49 English  Type : Comment
are the file attributes (+permissions) copied correctly ? if you run the script as root or via sudo, isn't it modified to be owned by root/root ?

à part from this, I can't see no reason hy your problem should arise.
By: roe1and Date: 28/03/2008 16:25:20 English  Type : Answer
i found out today that the shell scripts i was writing was being saved in windows text format. so when you look at it in unix the end of the lines contained ^M which was causing all the drama! when i removed all those everything worked perfectly. i blame bill gates, of course!
By: VGR Date: 28/03/2008 18:34:39 English  Type : Comment
yes, that's why I developed a unix2dos() supplement to the dos2unix() function

this said, you should use a text editor on windaube that copes with the single LF (unix-style) ; not to name it, Wordpad is the one which comes to mind. Better editors like UltraEdit or NoteTab Light are also capable of maintaining themselves the end-of-line specifics for each file, even when edited on windaube.

just my 0.02 U$D

Do register to be able to answer

EContact
browser fav
page generated in 339.850900 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page