From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v753) In-Reply-To: <47F5305E.305@mtu.edu> References: <47F14BCA.2902CD2A@null.net> <81975c3b0804010222y27b214ecgb4959b1cbc80ce71@mail.gmail.com> <13426df10804030946u531fbe0drf06c8fa3c5964183@mail.gmail.com> <599f06db0804031104l29a8907bm7bf184e32804555c@mail.gmail.com> <20080403182301.GA940@shodan.homeunix.net> <38229A66-D771-46FB-9D4B-B1A1733D0FF0@mac.com> <47F5305E.305@mtu.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <097B06DD-D941-4CCB-BDD2-5494C7EF572A@mac.com> Content-Transfer-Encoding: 7bit From: Pietro Gagliardi Date: Thu, 3 Apr 2008 15:44:52 -0400 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] bug in echo? Topicbox-Message-UUID: 87dcf16e-ead3-11e9-9d60-3106f5b1d025 Ah good one. The order of interpretation is: -f -i command line On Apr 3, 2008, at 3:30 PM, Steven D. Vormwald wrote: > Pietro Gagliardi wrote: >> 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. > > What should it do if you mix -f and -i? >