LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-07-2009, 03:09 PM   #1
sir-lancealot
Member
 
Registered: Aug 2007
Posts: 346

Rep: Reputation: 31
Bash CGI / HTML output on one line


Seems like a simple thing, but I can't get it to work. Basically I have an in house admin type page that is just querying load, etc. on our internal webservers displaying on a webpage. My problem is keeping text, etc. on one line and I am not saavy enough so a 1 line answer is prob all it will take.

The script is in it's infancy, but simple looks like this;

#!/bin/bash
echo "Content-type: text/html"
echo "<html>"
echo "<pre>"
echo "Svr1 Status:"
ssh svr1 w | awk '/load/ {print $10}'
echo "ttl httpd:"
ssh svr1 ps aux |grep -c httpd
echo "</pre>"
echo "</html>"

The output looks like;
Svr1 Status:
1.71,
ttl httpd:
59

Basically I would like the load on the box next to the status, the httpd count next to the ttl. Mind you this is not mission critial, but there will be several servers, and I would like a simple snapshot to see.

Thanks
 
Old 01-07-2009, 03:16 PM   #2
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
Check on the -n flag for echo. It prevents echo from adding a newline character for every print:
Code:
#!/bin/bash

echo -n "Hello, "
echo "world"
 
  


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
C Cgi Html sci3ntist Programming 1 02-20-2008 09:10 PM
Bash store last line from displayed text output in a variable carl0ski Programming 1 01-16-2007 03:38 AM
how to print my CGI programs output inside an HTML zaveko Programming 9 10-11-2005 05:37 PM
Bash: add date to output line blizunt7 Programming 7 11-10-2004 03:45 AM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 07:39 AM

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

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