I am new to using UNIX and after uploading a new script to UNIX from Windows using FTP, the script doesn't always work. It seems this depends on the text editor I use and the transfer type. I understand all scripts should be transferred using ASCII, but can you advise which is the best text editor to use out of Notepad and Wordpad?
After doing some research it seems wordpad is most popular, however I had problems with this, and my script now works after opening and saving in notepad as a test document with qoutes encasing the filename.
Provided you save the document in ASCII, using any text editor has no difference. For me I will prefer Notepad because it is a text editor, not a "word processor" that can save text files. But you can just use any other free/commercial text editors on Windows anyway. I will only use notepad when there is no alternative installed because it doesn't do syntax highlighting. For me, I install gvim on Windows. The choice is always yours.
Most likely you did not save the file as ASCII text, so it may become doc or rtf or something like that.
As a general rule, just make sure you are always saving the script as ASCII text, and always use FTP ASCII mode (if you use Binary mode, you have to use a Windows text editor that supports Unix EOL, and save the script with Unix EOL).
Being new to UNIX, using the editor VI has previously proved to be a bit of a challenge and has taken some time to come to terms with the different keys that should be used for navigating around VI.
However, since posting this topic I have been on a UNIX course and have a much better understanding now of permissions, FTP, VI and much more
regardless of what text editor one uses in windows, one should always get proficient in vi at a minimum --- ed would be even better --- since that would be the only text editor one can get if one runs into server problems and needs to modify files to get things working again ...
... there are two options, and they're both freeware.
Crimson Editor, which is so great for creating, editing and saving Unix files that I now have it set to edit practically every .dot file in my Cygwin install.
Alpine, a standalone version of Pine (Unix email client) and Pico (text editor) paired by their authors and onetime maintainers at the University of Washington. The Pico standalone app saves in UTF-8, so it might be worthwhile checking some of its saved output via cat or vi before uploading any of it. I'm partial to Pico and nano anyway, so I was very gratified to find there was a Win32 standalone of the former.
Here I would have to agree. Even the OS X Terminal, while providing nano (and maybe pico too, nowadays, who knows), installs with vim (vi modified) as the $EDITOR selection in its .bashrc. And most of the helps and how-to's for Mac command-line you find on the Web assume you use vim as your editor.
No panacea that dos2unix (or 'tleast maybe the one I use isn't robust enough).
I've had occasions happen where it left garbage characters (carat-qmark pairings particularly) in files I thought were, at minimum, ASCII and the line-endings just needed tweaking. I find the better approach to be to use a CLI editor or the GUI one I mentioned in my previous post, Crimson Editor.