![]() |
Fedora gedit for bash has become useless
[rant]
The more Fedora advances, the more useless it is becoming - recall my other issues... Now I find that gedit is producing a "Windows" formatted text, that won't run as a bash script. Do any of the learned linux guys have a quick fix? I'm about to trash Fedora. Maybe it's past time... [/rant] Thanks for any help... |
Check the line ending setting. You want "Unix" line termination, not "Windows" or "Mac".
I don't use gedit personally, as I really dislike Gnome, but googling tells me there should be a "Line Ending" setting when you save the file. |
Your system should also have 'unix2dos' and 'dos2unix' utilities that allow you to retroactively fix the line endings on files you have.
Windows notepad similarly cannot properly display files with unix line endings; I work around as necessary. Incompatibilities between text editors are low on the list of cross-platform problems that I have to deal with. |
Thank you for the replies. I had looked with no success for the line ending setting. It must be hiding with the un/redo entries I'm suppose to have.
Anyway, the problem is fixed. I unwittingly caused it due to another recent shortfall of Fedora: files no longer allows for the creation of a new document via a right-click. Therefore, I copied/pasted an existing .sh file and edited it. Apparently the c/p transformed the original's line endings for some unknown reason. By starting afresh with a new gedit document, and creating/saving a .sh file with the proper first line, the line endings are correct for the rest of the editing. I was unaware of the two conversion routines. Thanks! I may make use of those. |
1 Attachment(s)
:mike:
|
For fun you can use [c]od[/c] to view the actual contents of a file.
[CODE]$ cat dos.txt | od -c 0000000 a b c 1 2 3 \r \n 1 2 3 a b c \r \n 0000020 $ cat unix.txt | od -c 0000000 a b c 1 2 3 \n 1 2 3 a b c \n 0000016[/CODE]More info: [URL]http://stackoverflow.com/questions/2613800/how-to-convert-dos-windows-newline-crlf-to-unix-newline-n-in-bash-script[/URL] |
[QUOTE=jasonp;433615]Windows notepad similarly cannot properly display files with unix line endings; I work around as necessary.[/QUOTE]Open the file in "Wordpad" first, then just save it and then open it in "Notepad".
:ick: |
[QUOTE=jasonp;433615]Windows notepad similarly cannot properly display files with unix line endings; I work around as necessary. Incompatibilities between text editors are low on the list of cross-platform problems that I have to deal with.[/QUOTE]
Funnily enough, the "edit" command in the DOS box ("run command...") can deal with unix line endings; just opening and saving the text file should convert the line endings to CR LF. At least that was in XP times, and I do not use Windows much. Of course, notepad++ can handle such things too. [QUOTE=EdH;433584] Now I find that gedit is producing a "Windows" formatted text, that won't run as a bash script. Do any of the learned linux guys have a quick fix? [/QUOTE] With standard coreutils, from dos to unix (delete CR):[CODE]tr -d '\r' <winfile.txt >unixfile.txt[/CODE]or in-place with sed (and with a backup file): [CODE]sed -i.bak 's:\r::g' textfile.txt[/CODE] |
in windoze, use Programmers' Notepad !
(one of the best, small, and free!) (no, eclipse is not "small") You can select what line endings you want, and write your own scripts, own menu commands, etc, if you like. It also has a nice [URL="http://www.pnotepad.org/add-ons/"]python extension[/URL] and lots of syntax schema... |
Notepad.
I remember using Notepad. Once I had to create a web based tutorial on using FrontPage. FrontPage was so awful I wrote the tutorial in Notepad. |
[QUOTE=Xyzzy;433632]Open the file in "Wordpad" first, then just save it and then open it in "Notepad".
:ick:[/QUOTE] Try NotePad++. It blows away NotePad on all fronts. |
| All times are UTC. The time now is 08:56. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.