[Ilugc] What is wrong in this script ?

  • From: benignbala@xxxxxxxxx (Balachandran Sivakumar)
  • Date: Fri, 29 Jul 2011 12:32:00 +0530

Hi,

On Thu, Jul 28, 2011 at 9:09 PM, Mukesh Yadav <mak.gnu at gmail.com> wrote:



there is no ^M character in file I opened in vi editor and also in gedit,
Its only 6 lines of code.


         The problem here was because of line endings as pointed out
by others. In DOS/Windows, line endings would be "\r\n", commonly
called CR LF. In UNIX, it is just "\n", or just LF. So, if you edit a
file in windows(say Notepad) and view it in UNIX, you will find ^M,
which is the "\r". This wikipedia link[0] might help. dos2unix removes
these additional characters and hence solves the problem.

         If you run into this issue again, try doing ":set list on" in
vi/m. That would show you the meta characters as well(like tabs,
spaces line endings etc.). IIRC, Emacs should show them by default.
Not sure about gedit others. etc. Thanks


[0] -  http://en.wikipedia.org/wiki/Newline
-- 
Thank you
Balachandran Sivakumar

Arise Awake and stop not till the goal is reached.

Mail: benignbala at gmail.com
Blog: http://benignbala.wordpress.com/

Other related posts: