UTF file in bash?
Hi All!
I have been writing some bash scripts in JEdit 4.2Pre6. I have line endings set Unix \n and UTF8 encoding. Thing is, bash is choking on them when there is nothing wrong with the syntax.. Mostly I see this happening when I am using the line continuation character. I know the syntax is ok because I can run the same code from a script when I save it using Kate for example.) Is this a setting issue? Does bash not know how to read UTF8? I am using bash 2.05b-20 Thanks for any advice! |
for some things bash will be unhappy with UTF-8 standard encoding.
UTF-8 is pretty much like ASCII up to char #127 - it's one byte. The original vertsions of bash like old-fashioned ASCII, I don't know about newer versions. However carriage control under unix means ASCII 10 "^J" is newline -- \n. Under UTF-8, based on unicode, you can have two characters for newline ASCII 10 "^J" and ascii 13 "^M". Use od on your bash scripts to look for these spuriouscarriage control chars. They will also show up in vi. UltraEdit and some other Windows PC editors will convert lower UTF-8 to so-called unix as well. Short answer - learn to use vi or emacs for shell scripts. |
All times are GMT -5. The time now is 06:32 PM. |