I had copy/pasted a couple scripts that worked just fine, but when I typed it in myself, all my arrays had only one element in them. The code was identical, but it wasn't working. I figured it might be execution permissions, but (as far as I can tell) cygwin doesn't worry about that. I figured I was missing a package on the install, but when I ran the commands from the terminal, they all worked.
So this morning, in my desperation, I turned on "Show All Characters" in Notepad++ (my text editor of choice). BINGO! The difference between my code and the code that I copy/pasted is that I had carriage returns and line feeds in my code and there were only line feeds in the code that worked. I was able to correct this by telling Notepad++ to format the text in "Unix Format". After doing this and running the script, my arrays were full of the lines in the text file.


0 comments:
Post a Comment