RE: Backup script runs on AIX but not on Linux

  • From: "Allen, Brandon" <Brandon.Allen@xxxxxxxxxxx>
  • To: "J. Dex" <cemail_219@xxxxxxxxxxx>, Waldirio Manhães Pinheiro <waldirio@xxxxxxxxx>, "m.haddon@xxxxxxxxx" <m.haddon@xxxxxxxxx>, "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 6 Jan 2009 10:11:09 -0700

Yes, that's normal with vi on Linux - this drove me crazy for an hour or two 
when I first started working on Linux too.  For some reason the Linux version 
of vi doesn't show the DOS characters, but if you look at the bottom line of 
your vi window it should say [dos] if they are present, like this:

-------------------------------------------------------
myhost>vi testfile.txt
This
is
my
test
file
~
~
"testfile.txt" [dos] 5L, 27C          1,1           All
-------------------------------------------------------

The only way I know of to make it display the characters is with the very 
cryptic command ":edit ++ff=unix", e.g.:

-------------------------------------------------------
myhost>vi testfile.txt
This ^M
is^M
my^M
test^M
file^M
~
~
:edit ++ff=unix
-------------------------------------------------------

Also, beware that this problem will occur whether you transfer the file via FTP 
(in either binary or ascii mode), or SCP.

Regards,
Brandon

From: J. Dex [mailto:cemail_219@xxxxxxxxxxx]

I ran dos2unix on the script and it fixed it.  Even though I couldn't see any 
DOS characters, they must have been there somewhere because this fixed the 
problem.


________________________________
Privileged/Confidential Information may be contained in this message or 
attachments hereto. Please advise immediately if you or your employer do not 
consent to Internet email for messages of this kind. Opinions, conclusions and 
other information in this message that do not relate to the official business 
of this company shall be understood as neither given nor endorsed by it.

Other related posts: