From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] bug in echo?
Date: Thu, 3 Apr 2008 15:11:32 -0400 [thread overview]
Message-ID: <38229A66-D771-46FB-9D4B-B1A1733D0FF0@mac.com> (raw)
In-Reply-To: <20080403182301.GA940@shodan.homeunix.net>
The ultimate echo, actually useful, but no one wants it.
NAME
echo: echo arguments
SYNOPSIS
echo [-1abCDEeilmNnOqrtuVvwXx] [-B base] [-c cmd] [-d char] [-f
file] [-L len] [-o file] [-S voice] [-s char] [args...]
DESCRIPTION
echo outputs its arguments. It takes the following switches:
-1 One argument per line.
-a Output in ASCII. The default.
-B base Output in given base, 2..32. Unless -u also given, base > 10
shows lowercase.
-b Output in binary.
-C Don't echo anything, just print the number of fields.
-c cmd Run cmd on each argument, replacing $? with the argument itself.
-D Output in decimal.
-d char Field delimiter. Default is end of argument.
-E Print to standard error instead of to standard output.
-e Allow escape sequences
-f file Read from file, then from command line (if any).
-i Read arguments from standard input.
-L len Line width set to len. Default is to ignore line lengths.
-l Turn uppercase to lowercase.
-m Multi-column output.
-N One field per line, numbering each field.
-n Suppress newline.
-O Output in octal.
-o file Write to file instead of standard output.
-q "Quiet mode:" redirect output to /dev/null if not to a file.
-r Print every string that matches each regular expression. Regular
expressions cannot contain + or * modifiers.
-S voice Send to speaker, having the given voice say it. If voice is
a null string, use the default voice.
-s char Separate fields with char, default space.
-t Separate fields with tabs.
-u Convert lowercase to uppercase. With -B, output in uppercase
letters for base > 10.
-V Strip non-printing characters.
-v Make non-printing characters visible.
-w If -l is given, word wrap instead of character wrap. Otherwise,
ignored.
-X Output in uppercase hexadecimal.
-x Output in lowercase hexadecimal.
Test for everyone: write this echo in as little code as possible. C
or rc is permitted. The rules:
- for C: either Standard C (no other libraries) or only libc (no
other Plan 9 libraries)
- for rc: only use programs in the core Plan 9 distribution - no
programs that I have to get myself
- match the behavior EXACTLY as above
- shortest code and fastest run time wins
Winner gets something cool.
next prev parent reply other threads:[~2008-04-03 19:11 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-26 11:41 Gorka Guardiola
2008-03-26 12:27 ` Rob Pike
2008-03-26 12:41 ` Gorka Guardiola
2008-03-26 12:52 ` Sape Mullender
2008-03-26 13:19 ` Gorka Guardiola
2008-03-26 20:27 ` Iruata Souza
2008-03-26 12:40 ` Anthony Martin
2008-03-26 13:13 ` Gorka Guardiola
2008-03-26 13:19 ` Joel C. Salomon
2008-03-26 13:40 ` Gorka Guardiola
2008-03-31 8:58 ` Douglas A. Gwyn
2008-03-26 13:55 ` erik quanstrom
2008-03-26 15:52 ` Gorka Guardiola
2008-03-26 17:26 ` roger peppe
2008-03-26 18:10 ` erik quanstrom
2008-03-26 18:58 ` Pietro Gagliardi
2008-03-26 19:38 ` Joel C. Salomon
2008-03-26 19:43 ` Francisco J Ballesteros
2008-03-26 20:01 ` Pietro Gagliardi
2008-03-26 20:09 ` andrey mirtchovski
2008-03-26 20:22 ` Pietro Gagliardi
2008-03-26 20:30 ` andrey mirtchovski
2008-03-26 20:56 ` Pietro Gagliardi
2008-03-26 22:06 ` Iruata Souza
2008-03-26 22:26 ` Pietro Gagliardi
2008-03-26 22:54 ` Iruata Souza
2008-03-27 3:40 ` Robert William Fuller
2008-03-27 3:47 ` Bruce Ellis
2008-04-01 9:07 ` Douglas A. Gwyn
2008-03-27 1:57 ` Gorka Guardiola
2008-03-27 2:17 ` Gorka Guardiola
2008-03-27 2:21 ` Joel C. Salomon
2008-03-27 2:37 ` Pietro Gagliardi
2008-03-27 3:45 ` Bruce Ellis
2008-03-27 16:37 ` john
2008-03-27 17:03 ` [9fans] databases erik quanstrom
2008-03-27 19:08 ` Pietro Gagliardi
2008-03-28 4:05 ` a
2008-03-28 3:46 ` [9fans] bug in echo? a
2008-03-31 16:26 ` Russ Cox
2008-04-01 9:07 ` Douglas A. Gwyn
2008-03-26 20:10 ` roger peppe
2008-04-01 9:06 ` Douglas A. Gwyn
2008-04-01 9:06 ` Douglas A. Gwyn
2008-04-01 9:22 ` Anders Li
2008-04-03 8:54 ` Douglas A. Gwyn
2008-04-03 16:46 ` ron minnich
2008-04-03 18:04 ` Gorka Guardiola
2008-04-03 18:23 ` Martin Neubauer
2008-04-03 19:11 ` Pietro Gagliardi [this message]
2008-04-03 19:30 ` Steven D. Vormwald
2008-04-03 19:44 ` Pietro Gagliardi
2008-04-03 22:16 ` a
2008-04-03 22:26 ` Pietro Gagliardi
2008-04-03 22:44 ` John Floren
2008-04-03 22:53 ` Pietro Gagliardi
2008-04-03 23:12 ` Martin Neubauer
2008-04-08 23:51 ` david parsons
2008-04-09 0:02 ` Pietro Gagliardi
2008-03-26 13:15 ` Joel C. Salomon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38229A66-D771-46FB-9D4B-B1A1733D0FF0@mac.com \
--to=pietro10@mac.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).