LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-21-2019, 09:46 AM   #1
n1uro
Member
 
Registered: Feb 2016
Posts: 32

Rep: Reputation: Disabled
BASH CGI stripping line feeds in variable


I'm in the process of converting my old CGIs that rely on the now-defunct <ISINDEX> to use <FORM> directives. Everything seems fine EXCEPT the results when displayed in browsers lose their line feeds. If I push the variable to a file and cat it at the console it's fine, but even if I cat the file in the browser headed by <pre> it still shows the variable without line feeds.

Anyone have any clue as to why or a fix?

Much appreciated.
 
Old 11-21-2019, 10:48 AM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,734

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by n1uro View Post
I'm in the process of converting my old CGIs that rely on the now-defunct <ISINDEX> to use <FORM> directives. Everything seems fine EXCEPT the results when displayed in browsers lose their line feeds. If I push the variable to a file and cat it at the console it's fine, but even if I cat the file in the browser headed by <pre> it still shows the variable without line feeds.

Anyone have any clue as to why or a fix?

Much appreciated.
Browsers don't see line feeds at all. Replace them with a <br> tag.
 
Old 11-21-2019, 06:46 PM   #3
n1uro
Member
 
Registered: Feb 2016
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Browsers don't see line feeds at all. Replace them with a <br> tag.
Thanks, but that wasn't what I was talking about. In any event I fixed the issue.
 
Old 11-21-2019, 07:05 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,734

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by n1uro View Post
Thanks, but that wasn't what I was talking about. In any event I fixed the issue.
Please share your fix for folks looking for answers in the future...
(And maybe clarify what you were talking about?)

Last edited by scasey; 11-21-2019 at 07:08 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BASH stripping spaces from string stops it working knobby67 Programming 7 04-21-2016 10:56 AM
-bash: HISTSIZE: readonly variable -bash: HISTFILESIZE: readonly variable deathsfriend99 Linux - Newbie 4 12-08-2009 12:51 PM
Stripping lines versus stripping bytes in a bash subshell. poorman_installer Programming 9 10-21-2009 08:36 AM
[SOLVED] Bash and netcat: Stripping http header Prokke Programming 9 10-05-2009 02:58 AM
stripping of bash code? Lindows45 Linux - Newbie 2 03-01-2004 07:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration