|
Posted by mbstevens on December 30, 2005, 2:44 pm
Please log in for more thread options
Eric Lindsay wrote:
> I can't figure how to best display little snippets of shell script using
> <pre>. I just got around to organising to bulk validate some of my web
> pages, and one of the problems occurs with Bash shell pieces like this:
>
> <pre><code>
> #!/bin/sh
> ftp -i -n ftp.server.com< <EOF
> user username password
> epsv4
> cd /
> lcd ~/Documents/web101
> put test.htm
> quit
> EOF
> </code></pre>
> </p>
>
> If I leave the << to indicate I am using a Here document, then the WDG
> validator complains about all sorts of stuff.
>
> If I use adjoining << with no space, then the first < displays,
> but the rest of the code example disappears.
>
> If I add a space between the two < < the code shows, but the use
> of the double << for a Here document isn't clearly shown.
>
> Live page is at http://ericlindsay.com/blog/200508.htm#5 and will show
> one of the three problems.
>
> Can anyone straighten out my thinking on this?
>
Yes, it truncates to this on Mozilla in Slackware:
#!/bin/sh
ftp -i -n ftp.server.com <
...truncating after that first <.
Since Spartanicus and L. Blaisdell can't see it,
I think it's something specific to browser decoding.
I use <pre> a lot, and that's something I havn't run into
before.
I downloaded it and played with it a bit. The thing that
brings it back under Moz/Slack is using <<, as you
predicted. I suspect you'll just have to live with WGD's
complaint, but both > characters display under Moz. What
browser are you using that displays it only as a single >?
The other problem is that under Moz/Linux, the newlines you are
using inside the <pre> do not show up in the Moz display.
I had to go in with vim and add the newlines myself to get
the lines to display in the <pre> correctly.
--
mbstevens
http://www.mbstevens.com/howtothumb
|