Announcement
Collapse
No announcement yet.
BASH help please.....
Collapse
This topic is closed.
X
X
-
Kate is Windows/DOS 'aware'.
End of Line – There is a big and irritating difference between the way that Windows-based programs and Linux programs deal with line endings in text files. The standard text file line ending in Windows is two special characters, a carriage return followed by a line feed, while in Linux it’s one special character, a line feed alone. This can cause major problems when text files created in one OS are opened in the other. Most Linux-based text editing programs recognise this and provide an option to convert to Windows conventions when saving the file. Kate has also provided this option under Tools as a separate command – plus an additional option for the Macintosh.
I believe that when Kate opens a text file created in Windows/DOS, those two special characters are preserved. To convert them to the Linux single character line feed, you need to go to Tools > End of Line and ensure that UNIX is selected. This is easy enough to confirm. Check that Kate is configured for UNIX End of Line. Open a Windows/DOS text file (that hasn't been played with in Linux). Check Tools > End of Line. My bet is it will show Windows/DOS.Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
- Top
- Bottom
Comment
-
Desktop PC: Intel Core-i5-4670 3.40Ghz, 16Gb Crucial ram, Asus H97-Plus MB, 128Gb Crucial SSD + 2Tb Seagate Barracuda 7200.14 HDD running Kubuntu 18.04 LTS and Kubuntu 14.04 LTS (on SSD).
Laptop: HP EliteBook 8460p Core-i5-2540M, 4Gb ram, Transcend 120Gb SSD, currently running Deepin 15.8 and Manjaro KDE 18.
- Top
- Bottom
Comment
-
I just noticed that Geany actually shows the EOL mode in the status line too.Desktop PC: Intel Core-i5-4670 3.40Ghz, 16Gb Crucial ram, Asus H97-Plus MB, 128Gb Crucial SSD + 2Tb Seagate Barracuda 7200.14 HDD running Kubuntu 18.04 LTS and Kubuntu 14.04 LTS (on SSD).
Laptop: HP EliteBook 8460p Core-i5-2540M, 4Gb ram, Transcend 120Gb SSD, currently running Deepin 15.8 and Manjaro KDE 18.
- Top
- Bottom
Comment
-
Originally posted by Snowhog View Post...To convert them to the Linux single character line feed, you need to go to Tools > End of Line and ensure that UNIX is selected. This is easy enough to confirm. Check that Kate is configured for UNIX End of Line. Open a Windows/DOS text file (that hasn't been played with in Linux). Check Tools > End of Line. My bet is it will show Windows/DOS.
I did discover that if one turns off Settings | Configure Kate | Editor Component | Open/Save | General tab | Automatic end of line detection, and Tools | End of Line is set to UNIX, kate will silently read a file with DOS line endings, and save it with UNIX ones if you make changes to it. That would be dangerous if one works with files that brain damaged windows software needs to read; I've encountered XML like that. Thankfully, most windows apps are happy with unixy newlines.
I've just had a hunt around the Kate documentation and discovered lots about it's scripting with javascript, but they're limited to "indenting" and "command line" scripts; there isn't a hook to run a script after loading a file (though I did write a "command" that set line-endings to unix) and the API is quite limited, I couldn't find any access to the UI.
Regards, John LittleRegards, John Little
- Top
- Bottom
Comment
-
Originally posted by Rod J View PostI occasionally use Geany (a great little program editor/IDE) rather than Kate sometimes. It makes developing and testing script files a breeze. Geany has an option to show the EOL character(s).
The setting is View, Editor, Show Line Endings in Geany.
@JL --- Thanks for the info. Keep that in mind too since I do have to go between the two OSs.
- Top
- Bottom
Comment
-
Pan-Galactic QuordlepleenSo Long, and Thanks for All the Fish
- Jul 2011
- 9524
- Seattle, WA, USA
- Send PM
Originally posted by MoonRise View PostCode:myDATE=`date '+%m%d%Y'` myTIME=`date '+%H%M%S'`
Code:myDATE=$(date '+%m%d%Y') myTIME=$(date '+%H%M%S')
Code:myDATE=$(date '+%Y%m%d')
- Top
- Bottom
Comment
-
Originally posted by SteveRiley View PostOne other tip. Backticks are deprecated. Instead, use command substitution. The advantage is that you don't have to escape any dollar signs, backticks, or back slashes inside the command.
- Top
- Bottom
Comment
-
I usually do use the ISO format for sorting purposes but the way this is really used wasn't necessary and the user who gets this generared file is use to a system of ours that displays as I have here. In all my readings I did run across the two formats for the command but it was never clear one over the other so I'll keep that in mind.
- Top
- Bottom
Comment
Comment