I
I
Ilya Fateev2014-02-24 15:39:00
Apache HTTP Server
Ilya Fateev, 2014-02-24 15:39:00

How to make beautiful shell script output in cgi-bin?

There is apache2.2, in cgi-bin there is a shell script that should display the result of df -h, but it displays everything in one line.

#!/bin/bash
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>Sensors info</title>'
echo '</head>'
echo '<body>'
#df -h | grep "/dev/sda7" 
df -h  
echo '<br>'
echo '</body>'
echo '</html>'

Question: is it possible to draw a conclusion line by line, and how can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2014-02-24
@fat32nov

...
echo '<body><pre>'
df -h
echo '</pre></body>'
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question