2485 Views 3 Replies Latest reply: May 10, 2010 4:55 PM by Samuel Smith2
It 's all about [newline|http://en.wikipedia.org/wiki/Newline] . Either configure your gui text editors to save files with " " (unix line endings) or convert them before you copy and paste them into nano.
#!/bin/bash -- # loose the -- after bash
#comment each line or it may be read
#Eden Nelson - 4/14/08
#Sam Smith 4/15/08
#755 = rwxrwxr-x
Yes I already double checked that bbedit is set to newline mode and that the particular
file is using newlines. I doubled checked by making a copy of the file in mac return line mode and then using $ more to display both. The newline version displays correctly. The carriage return version has lots of ^M in more.
But it is not the line mode in a gui text editor.
The same thing happens when I copy and paste from terminal.
For example if I put the information in file.txt with newlines.
Then do in terminal
$ cat file.txt
mouse select catted text in terminal
$ nano newfile.sh
The problem happens.
Its something happening with nano and the clipboard that is not just newline. Like some kind of
Please note that if it were just a newline problem it would not be deleting the # symbols.
I found the problem. It is a configuration issue with apple terminal.
If the counter intuitively labeled option"
"Paste newlines as carriage returns" is ENABLED
then the problem occurs.
If the option is DISABLED then the problem goes away.
So I am speculating that nano expects the mac clipboard to always be carriage returns and
when it isn't it messes up. Or else the terminal UI is messed up and the option is mislabeled.