LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2012, 06:41 PM   #1
grantwnorman
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Rep: Reputation: 1
output skewed when telnetting to bash script


Hey LQ Users-

I have a simple bash menu script that I have setup in xinetd as a service listening on port 3333. The script output (formatting) looks fine when running it from a SSH terminal and also when I telnet localhost 3333, however, it is completely skewed when running it from a remote pc via telnet. I have tried several different remote computers to verify it is not the local settings of the telnet client.

Is there any sort of formatting tricks or tips anyone can provide me to ensure the output is consistent when viewing over a remote telnet session?

The script I am using as an example is at:
http://www.troubleshooters.com/codecorn/sockets/

I have attached 2 screenshot examples, one showing the layout via a local telnet and one via a remote telnet session.

Also, I have searched all over looking for a thread on this, but only seem to find threads regarding creating telnet scripts for checking server stats etc.

Any help is appreciated!
Attached Thumbnails
Click image for larger version

Name:	working.jpg
Views:	20
Size:	26.8 KB
ID:	10649   Click image for larger version

Name:	not-working.jpg
Views:	24
Size:	24.6 KB
ID:	10650  
 
Old 09-10-2012, 07:25 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
That is an issue with end-of-line treatments. The local terminal is treating linefeeds as if there were carriage-returns included in the case that works. In the other, it seems to expect both CR + LF. The Linux convention is to use linefeed as if it is CR + LF. DOS/Windows usually expects both, although most software is configurable. Look for some configuration element that deals with end-of-line treatment.

--- rod.
 
Old 09-11-2012, 06:51 PM   #3
grantwnorman
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Original Poster
Rep: Reputation: 1
Thanks for the response, Rod.

There were no end of line markers originally, just empty echo statements for blank lines. I was able to get it working by adding the -e flag to the echo statements, and then sent a
Quote:
\n\r
as you recommended and it worked great on the PCs telnet session. Thanks for the direction on that!
 
  


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
Bash script gives weird output jonaskellens Linux - Newbie 31 02-18-2012 11:31 AM
BASH: Help with formatting Output from a script SilversleevesX Programming 4 08-23-2010 06:59 PM
Bash Script Missing Output Slick666 Programming 1 10-05-2007 07:09 AM
Telnetting to the bash prompt over Ethernet? WindsorKnot Linux - Networking 1 04-11-2007 04:57 PM
Test output from bash script estratos Programming 6 11-16-2006 09:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:27 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