Channels ▼

Al Williams

Dr. Dobb's Bloggers

<h1>Hello World!</h1>

August 19, 2011

I suspect most of us learned programming in a way that somehow involved the phrase "Hello World." Or, if you are from my part of the world (Texas), perhaps it was "Howdy World." The traditional equivalent for embedded systems has been making the LED blink. After all, a lot of systems don't have a display or maybe they have a little LCD — not very helpful to try to print out a string.

Today, though, a system is about as likely to have a network connection as anything else. Naturally, if you want to run a Linux system with an embedded web server, there are plenty to choose from (including Mongoose, which I've talked about a few years ago here).

On the other hand, you might just want to debug something on the fly. You might think writing a web server is a daunting task. If you want to write a robust and secure one it is a pretty big job. But I'm thinking something small, useful, and disposable.

One of the often-overlooked programming languages you have on a Linux-based board is your favorite shell. Many of the shells (including bash) are very full featured and because they run programs, totally extensible by just writing a little C code.

Could you write a web server in bash? You certainly can. A quick Google showed quite a few, in fact. If you really want minimalist, here's a server in one line: http://is.gd/yb1T7k.

In all fairness, it isn't just bash, of course. Programs like nc (netcat), but, as I said, you can think of those as extensions to the shell. If you want something a little easier to read, try http://is.gd/kxLUrh or http://is.gd/iDelqp.

Don't get me wrong. I'm not suggesting you'd actually use these for any real production purpose. But a quick and dirty web server running on a Linux board with very little software required (assuming you have nc, which most of them rely on heavily) can be very helpful in a lot of debugging and testing situations.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video