Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NAME
       nonsense	-- generates random text from datafiles	and templates

SYNOPSIS
       nonsense	   [-b	  bullet]   [-dDeF]   [-f   data_file]	 [-n   number]
		[-t template_file] [-p]	[tag ...]

DESCRIPTION
       Nonsense	generates random (and sometime humorous) text  from  datafiles
       and templates using a very simple, recursive grammar.  It's like	having
       a  million  monkeys  sitting in front of	a million typewriters, without
       having to feed or clean up after	them.  From fake Slashdot headlines to
       absurd college courses to buzzword bingo	cards, nonsense	is a good  way
       to waste	time.

       The following options are available:

       -b bullet
	       Specify a "bullet" go in	front of each item.

       -d      Debug mode (shows each substitution)

       -D      Verbose debug mode (shows each substitution and the result)

       -e      Disable direct eval()'s

       -f data_file
	       Specify a data file to load in.	Use multiple -f	options	to in-
	       clude  additional  files.   The	default.data  file  is	always
	       loaded.

       -F      Load all	*.data files.

       -n number
	       Repeat n	times.

       -t template_file
	       Use a template file.  The markup	in this	file will be processed
	       and the result output to	stdout.

       -p      Separate	each item with a blank line.

       The -d and -D options are mutually exclusive.

       Thanks  to  contributions  by  Fred   Hirsch   <truehand@darkhart.com>,
       nonsense	 can  also  be	executed  as  a	 CGI  script.	Details	are in
       /usr/local/share/doc/nonsense/README.

FILES
       /usr/local/share/nonsense/data/*	 nonsense data files.  Any files spec-
					 ified with the	-f option are found by
					 looking in the	current	directory  and
					 then  this  directory.	 The -F	option
					 loads all files in this directory.
       /usr/local/share/nonsense/template/*
					 nonsense template  files.   Any  file
					 specified with	the -t option is found
					 by  looking  in the current directory
					 and then this directory.

EXAMPLES
       Bellow is a list	of things that nonsense	can output with	the data files
       included.

       For a realistic simulation of the Slashdot homepage:

	     nonsense -t slashdot.html.template

       For a buzzword-enhanced mission statement that only  a  "Pointy	Haired
       Boss" could love:

	     nonsense -f mission.data

       For a PHB-inspired business plan	(in HTML):

	     nonsense -t bizplan.html.template -f mission.data

       For a person's name:

	     nonsense Person

       For a long list of random fake e-mail addresses suitable	for sending to
       a spammer's e-mail harvester:

	     nonsense FakeEmail	-n 1000

       For a buzzword bingo card (in HTML) to print out	for your next meeting:

	     nonsense -t bingo.html.template

       For  a  listing	of absurd college classes (these might be offensive to
       liberal-arts professors):

	     nonsense -f college.data -n 20

       For a  listing  of  political  organizations  (again,  these  might  be
       offensive to certain people):

	     nonsense OrgPolitical -n 10

       For a listing of	stupid laws that may or	may not	really exist:

	     nonsense -f stupidlaws.data -n 10

       For a list of Open Source programs as they would	appear on Freshmeat:

	     nonsense -f linux.data FreshmeatApp

       For the resume of a random geek (in HTML):

	     nonsense -f resume.data -t	resume.html.template

       For a news headline:

	     nonsense -f newspaper.data	Headline

       For the front page of a newspaper (in HTML):

	     nonsense -f newspaper.data	-t newspaper.html.template

       For a cheap replacement for the fortune(6) program:

	     nonsense -F Fortune

       To  produce  a  file  containing	 100  items  suitable  for  feeding to
       fortune(6):

	     nonsense -F FortuneFile -n	100

FILE FORMATS
       Nonsense	reads in "template files" and "data files".

       A template file is merely a text	file  containing  "tags"  enclosed  in
       curly braces (`{' and `}').  Nonsense substitutes random	text for these
       tags using a really crude markup	language.

       A  data file is a text file divided into	sections (seperated by a blank
       line), each one containing  a  list  of	text  items  (seperated	 by  a
       newline)	that are randomly selected to fill in the template.

       There are a few special cases that allow	nonsense to handle more	elabo-
       rate situations:

       {#number1-number2}
	       This  tag will be replaced with a random	number between number1
	       and number2 (inclusive).

       {[item1|item2|item3...}
	       This tag	will be	replaced with one item from the	list.  If only
	       one item	is listed then it will be output %50 of	the time  (and
	       nothing output the other	50%).

       {@strftime format}
	       This  tag will be replaced with the current date/time using the
	       strftime(3) format string.  So, for instance, {@A} would	be re-
	       placed with the current day of the week.

       {@strftime format|number1|number2}
	       Same as above, but uses the date/time that occurred  X  seconds
	       ago,  where  X  is a random number between number1 and number2.
	       For  instance,  {@%H:%M|0|86400}	 would	be  replaced  by   the
	       hour:minute anywhere from 0 to 86400 seconds (1 day) ago.

       {;short perl code segment}
	       The  perl  code	within	the braces will	be evaluated.  This is
	       useful for doing	something really complicated that requires the
	       full power of Perl.  However, this is risky  since  there's  no
	       error checking and no "sandbox".	 You can disable this behavior
	       with the	-e option.

       {\character}
	       This allows literal characters that couldn't otherwise be spec-
	       ified, such as:
		     {\n}    newline
		     {\0}    null (i.e.	nothing)
		     {\L}    Left brace	(`{')
		     {\R}    Right brace (`}')
		     {\###}  ascii(7) character	in decimal

       {variablename=literal text}
	       Stores  the  text  on the right-hand side of the	equals sign to
	       the specified  state  variable,	without	 outputting  anything.
	       This is useful for preserving context and is used, for example,
	       in the Slashdot simulator.

       {variablename:=command}
	       Similar	to above, but evaluates	the command and	stores the re-
	       sult into a state variable.

       {$variablename}
	       Returns the contents of a state variable.

       {command#number1-number2}
	       Evaluates the command a random number of	times between  number1
	       and number2.

       Case  is	important!  {ProductName}, {productname} and {PRODUCTNAME} are
       slightly	different.  If the name	is given in lowercase,	the  substitu-
       tion  will  be converted	to all lowercase (i.e. fed through the perl lc
       function).

       Upercase	names specify the opposite; the	result is uppercoased with uc.
       Mixed case names	tell nonsense to leave the case	of  the	 result	 alone
       (this  is usually what is used).	 Finally, if you prepend a name	with a
       caret, `^' (i.e.	{^ProductName}), the result is fed  through  the  perl
       ucfirst function, which will capitalize the first character only.

SEE ALSO
       fortune(6)

       http://i-want-a-website.com/about-linux/downloads.shtml

AUTHORS
       The     nonsense	    program	is    written	 by    James	Baughn
       <nonsense@i-want-a-website.com>.

       Fred    Hirsch	 <truehand@darkhart.com>    and	    Peter     Suschlik
       <peter@zilium.de> have both submitted code.

       Send  suggestions,  comments, feedback, patches,	and new	datafiles/tem-
       plates to the above address.  Direct  your  hate	 mail  and  flames  to
       <devnull@i-want-a-website.com>.

       This	manual	   page	    was	    written    by    Dave    Chapeskie
       <dchapes@ddm.crosswinds.net> from the README file.

       Copyright 2000-2001.  This program and accompanying files are  licensed
       under the GNU General Public License 2.0.

BUGS
       The -e option is	not the	default.

				 March 6, 2001			   NONSENSE(6)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=nonsense&sektion=6&manpath=FreeBSD+Ports+15.0>

home | help