[Solved] gedit / bash version issue

Issues related to applications and software problems and general support
Post Reply
lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

[Solved] gedit / bash version issue

Post by lightman47 » 2022/05/10 18:21:46

{all machines/versions update weekly}

I have RHEL 8 and am writing scripts for all my machines, usually with gedit. My only two CentOS 7 machines (1 local, 1 remote) have been 'choking' on these shared scripts. Investigation reveals that my RHEL 8 gedit is now creating files whose lines end in CR/LF - and CentOS 7 bash doesn't like that additional "CR"!

I've looked on-line and in dconf-editor for how to "turn off" the creation of the 'carriage-return' to no avail. While I could spend hours and write something to go through the shared scripts and delete all the CRs, -- why?

Does anyone know how to:

1. get CentOS 7 bash to not 'choke' on the CRs

2. set (RHEL 8) gedit to NOT insert the CR's (which I assume is their attempt to 'become generic')

??

Thank you.
Last edited by lightman47 on 2022/05/13 16:57:40, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: gedit / bash version issue

Post by TrevorH » 2022/05/10 18:52:17

It's an option on the Save As... dialog pane. Down the bottom, next to Character Encoding, it says Line Ending and has choices for Unix/Linux, MAC OS Classic and Windows.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: gedit / bash version issue

Post by lightman47 » 2022/05/13 16:57:16

I did find and set that. Thank you.

For a while thereafter I researched, with no luck, on how to make that setting the default. A number of file edits later, it seems to now be the default! I can only conclude that Gedit defaults to the last setting used. From that, it's reasonable to assume I edited/saved a Windows file with it a few months ago (I likely did - though I'll never remember it now!).

Marking this solved. Thanks again.

INCIDENTALLY - what drove me to discover all this was script error messages: line {n}: $'\r': command not found on my CentOS 7 machines.
During script execution, CentOS 7 bash runs into a line terminated with a 'Windows style' CR/LF pair, as opposed to an expected LF.

I posted to CentOS 8 {RHEL 8} because that's what I am using, and in which I write scripts for both version systems thinking initially it might be some gedit or bash 'bug'.

Post Reply