Re: Dynamic IP script output from df or mount formatting problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Ward wrote:
> Hi all,
> 
> I have been playing with a script that works out your WAN / external
> IP address then uploads it to a web site every hour, so when I am at
> work and my provider changes my IP address I can look up what it has
> changed too.
> 
> This script has been rewritten several times now and I now have an
> html generated page that is starting to be functional with other
> useful info HOWEVER,
> 
> I cannot get the output from a df, mount or even fdisk to work as html
> because the text output from the commands contain no end of line
> control codes so instead of the output looking like
> 
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/hda3              8854472   7175844   1221580  86% /
> /dev/hda1               101086     21616     74251  23% /boot
> tmpfs                   127908         0    127908   0% /dev/shm
> 
> it looks like this with a word wrap, can any one show me how this is
> resolved with a small script or command to pipe it though.
> 
> Filesystem Size Used Avail Use% Mounted on /dev/hda3 8.5G 6.9G 1.2G
> 86% / /dev/hda1 99M 22M 73M 23% /boot tmpfs 125M 0 125M 0% /dev/shm
> 
> Thanks
> 
> Paul
> 
The problem is not that there are not end of the line control codes.
The problem is that the end of line codes are text and not html.
There are a couple of ways around this. One is to enclose the output
in <pro></pre> tags. The other it to change the type from text/htm
to text/plain and not use any html tags. That works if you are
enclosing the output of the command in a cgi script, and there is no
 html mixed in. Remember, in html, just because you started a new
line in your typing, it does not signal a new line in the output.
You have to use something like a <br> or <p> tag. Or use the <pre>
and </pre> tag to tell the browser not to mess with the formatting.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux