mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Linux

Reply
 
Thread Tools
Old 2016-05-11, 02:55   #1
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

552310 Posts
Default 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...

Last fiddled with by EdH on 2016-05-11 at 02:55
EdH is offline   Reply With Quote
Old 2016-05-11, 04:03   #2
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013
https://pedan.tech/

2×33×59 Posts
Default

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.
Mark Rose is online now   Reply With Quote
Old 2016-05-11, 13:10   #3
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

1101111011012 Posts
Default

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.
jasonp is offline   Reply With Quote
Old 2016-05-11, 13:29   #4
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

159316 Posts
Default

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.
EdH is offline   Reply With Quote
Old 2016-05-11, 15:22   #5
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

3×43×67 Posts
Default

Attached Thumbnails
Click image for larger version

Name:	gedit.png
Views:	239
Size:	93.7 KB
ID:	14349  
Xyzzy is offline   Reply With Quote
Old 2016-05-11, 15:28   #6
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

3·43·67 Posts
Default

For fun you can use od 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
More info:

http://stackoverflow.com/questions/2...in-bash-script
Xyzzy is offline   Reply With Quote
Old 2016-05-11, 15:31   #7
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

100001110000112 Posts
Default

Quote:
Originally Posted by jasonp View Post
Windows notepad similarly cannot properly display files with unix line endings; I work around as necessary.
Open the file in "Wordpad" first, then just save it and then open it in "Notepad".

Xyzzy is offline   Reply With Quote
Old 2016-05-11, 15:40   #8
ccorn
 
ccorn's Avatar
 
Apr 2010

2348 Posts
Default

Quote:
Originally Posted by jasonp View Post
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.
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:
Originally Posted by EdH View Post
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?
With standard coreutils, from dos to unix (delete CR):
Code:
tr -d '\r' <winfile.txt >unixfile.txt
or in-place with sed (and with a backup file):
Code:
sed -i.bak 's:\r::g' textfile.txt
ccorn is offline   Reply With Quote
Old 2016-05-13, 06:55   #9
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24·643 Posts
Default

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 python extension and lots of syntax schema...
LaurV is offline   Reply With Quote
Old 2016-05-13, 13:08   #10
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013
https://pedan.tech/

61628 Posts
Default

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.
Mark Rose is online now   Reply With Quote
Old 2016-05-13, 15:03   #11
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

26×113 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
Open the file in "Wordpad" first, then just save it and then open it in "Notepad".

Try NotePad++. It blows away NotePad on all fronts.
rogue is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Posts that seem less than useless, or something like that jasong Forum Feedback 1054 2022-06-20 22:34
bash and HTTP? Dubslow Information & Answers 11 2011-12-14 21:07
Fedora ecm installed, but where? jasong GMP-ECM 8 2011-01-03 03:57
Useless DC assignment lycorn PrimeNet 16 2009-09-08 18:16
Fedora tha Software 2 2004-01-13 23:12

All times are UTC. The time now is 22:06.


Tue Jun 6 22:06:48 UTC 2023 up 292 days, 19:35, 0 users, load averages: 0.92, 0.98, 0.98

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔