Operating Systems :: Unix :: using mv in shell scripts |
|||
| By: roe1and |
Date: 18/02/2008 15:31:04 |
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 | 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 | 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 | 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 |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








