This document should comply with the standards below. Click on one to check.

Valid HTML 4.01!

Valid CSS!


This very simple program has proven pretty useful. It just copies stdin to stout looking for lines that start with a hash bang (#!). When it finds one, that line is replaced by the stdout of the rest of the line as a command. Below are three versions.

# This just copies stdin to sdtout
# replacing all lines that start with #!
# with the results of the command on that line.
# This is good for templates.
while ( <> ) {
  if ( /^#!/ ) {
    system( $' );
  else {
ARGF.each { |theLine|
  if ( m = /^#!/.match theLine )
    system m.post_match
    puts theLine
while read line
  if [ "$command" = "$line" ]
    echo $line

Look at the Makefile in this directory to see one way it can be used to generate ubercat.html. We export some shell variables that are used within ubercat.html.uc. This way all the file names appear in the Makefile and none are hidden in ubercat.html.uc. Note that the Bash version cannot be used this way. It doesn't expand the shell variables in ubercat.html.uc.

When combined with something like tag.awk this can give us a poor man's HTML decorator. Look in the Makefile for how index.html is made.

See also Decorate XML. It is specialized to be friendlier to web designers. Note that the hash-bang commands for ubercat will break conformance with xml and possibly other standards.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License.

Valid HTML 4.01! 2006-04-16