Xref: utzoo comp.unix.questions:18113 comp.unix.wizards:19566 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!sahayman From: sahayman@iuvax.cs.indiana.edu (Steve Hayman) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Diffs to the Frequently Asked Questions postings Message-ID: <30652@iuvax.cs.indiana.edu> Date: 1 Dec 89 20:11:33 GMT Followup-To: comp.unix.questions Organization: Computer Science Department, Indiana University Lines: 449 Here are the most recent changes to parts 1 and 2 of the Frequently Asked Questions postings. *** /tmp/,RCSt1a08391 Fri Dec 1 15:11:14 1989 --- part1 Fri Dec 1 14:49:59 1989 *************** *** 1,5 **** --- 1,6 ---- Subject: Welcome to comp.unix.questions and comp.unix.wizards [Monthly posting] + [Last changed: $Date: 89/12/01 14:49:54 $ by $Author: sahayman $] Comp.unix.questions and comp.unix.wizards are two of the most popular and highest volume newsgroups on Usenet. This article is a monthly *** /tmp/,RCSt1a08405 Fri Dec 1 15:11:17 1989 --- part2 Fri Dec 1 14:50:16 1989 *************** *** 1,5 **** --- 1,7 ---- Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting] + [Last changed: $Date: 89/12/01 14:50:10 $ by $Author: sahayman $] + This article contains the answers to some Frequently Asked Questions often seen in comp.unix.questions and comp.unix.wizards. Please don't ask these questions again, they've been answered plenty of times *************** *** 19,25 **** How do I check to see if there are characters to be read without actually reading? How do I find the name of an open file? ! How do I rename "*.foo" to "*.bar"? Why do I get [some strange error message] when I "rsh host command" ? How do I find out the creation time of a file? How do I use "rsh" without having the rsh hang around --- 21,27 ---- How do I check to see if there are characters to be read without actually reading? How do I find the name of an open file? ! How do I rename "*.foo" to "*.bar", or change file names to lowercase? Why do I get [some strange error message] when I "rsh host command" ? How do I find out the creation time of a file? How do I use "rsh" without having the rsh hang around *************** *** 28,36 **** How do I {set an environment variable, change directory} inside a shell script and have that change affect my current shell? Why doesn't find's "{}" symbol do what I want? What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss} stand for? ! How do I pronounce "vi"? While these are all legitimate questions, they seem to crop up in --- 30,41 ---- How do I {set an environment variable, change directory} inside a shell script and have that change affect my current shell? Why doesn't find's "{}" symbol do what I want? + How do I redirect stdout and stderr separately in csh? + How do I set the permissions on a symbolic link? What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss} stand for? ! How do I pronounce "vi" , or "!", or "/*", or ...? ! While these are all legitimate questions, they seem to crop up in *************** *** 133,144 **** Put this in your .cshrc - customize the prompt variable the way you want. ! alias cd 'chdir \!* && set prompt="${cwd}% "' If you use pushd and popd, you'll also need ! alias pushd 'pushd \!* && set prompt="${cwd}% "' ! alias popd 'popd \!* && set prompt="${cwd}% "' Some C shells don't keep a $cwd variable - you can use `pwd` instead. --- 138,151 ---- Put this in your .cshrc - customize the prompt variable the way you want. ! alias setprompt 'set prompt="${cwd}% "' ! setprompt # to set the initial prompt ! alias cd 'chdir \!* && setprompt' If you use pushd and popd, you'll also need ! alias pushd 'pushd \!* && setprompt' ! alias popd 'popd \!* && setprompt' Some C shells don't keep a $cwd variable - you can use `pwd` instead. *************** *** 145,152 **** If you just want the last component of the current directory in your prompt ("mail% " instead of "/usr/spool/mail% ") ! you can do ! alias cd 'chdir \!* && set prompt="$cwd:t% "' Some older csh's get the meaning of && and || reversed. --- 152,160 ---- If you just want the last component of the current directory in your prompt ("mail% " instead of "/usr/spool/mail% ") ! you can use ! ! alias setprompt 'set prompt="$cwd:t% "' Some older csh's get the meaning of && and || reversed. *************** *** 163,169 **** If you have a newer version of the Bourne Shell (SVR2 or newer) you can use a shell function to make your own command, "xcd" say: ! xcd { cd $* ; PS1="`pwd` $ "; } If you have an older Bourne shell, it's complicated but not impossible. Here's one way. Add this to your .profile file: --- 171,177 ---- If you have a newer version of the Bourne Shell (SVR2 or newer) you can use a shell function to make your own command, "xcd" say: ! xcd() { cd $* ; PS1="`pwd` $ "; } If you have an older Bourne shell, it's complicated but not impossible. Here's one way. Add this to your .profile file: *************** *** 301,307 **** even exist is going to take some time. ! 9) How do I rename "*.foo" to "*.bar"? Why doesn't "mv *.foo *.bar" work? Think about how the shell expands wildcards. "*.foo" "*.bar" are expanded before the mv --- 309,315 ---- even exist is going to take some time. ! 9) How do I rename "*.foo" to "*.bar", or change file names to lowercase? Why doesn't "mv *.foo *.bar" work? Think about how the shell expands wildcards. "*.foo" "*.bar" are expanded before the mv *************** *** 345,351 **** If you don't have "basename" or want to do something like renaming foo.* to bar.*, you can use something like "sed" to strip apart the original file name in other ways, but ! the general looping idea is the same. A program called "ren" that does this job nicely was posted to comp.sources.unix some time ago. It lets you use --- 353,359 ---- If you don't have "basename" or want to do something like renaming foo.* to bar.*, you can use something like "sed" to strip apart the original file name in other ways, but ! the general looping idea is the same. A program called "ren" that does this job nicely was posted to comp.sources.unix some time ago. It lets you use *************** *** 352,357 **** --- 360,407 ---- ren '*.foo' '#1.bar' + Shell loops like the above can also be used to translate + file names from upper to lower case or vice versa. You could use + something like this to rename uppercase files to lowercase: + + C Shell: + foreach f ( * ) + mv $f `echo $f | tr A-Z a-z` + end + Bourne Shell: + for f in *; do + mv $f `echo $f | tr A-Z a-z` + done + + If you wanted to be really thorough and handle files with + `funny' names (embedded blanks or whatever) you'd need to use + + Bourne Shell: + + for f in *; do + eval mv '"$i"' \"`echo "$i" | tr '[A-Z]' '[a-z]'`\" + done + + If you have the "perl" language installed, you may find this rename + script by Larry Wall very useful. It can be used to accomplish a + wide variety of filename changes. + + #!/usr/bin/perl + # + # rename script examples from lwall: + # rename 's/\.orig$//' *.orig + # rename 'y/A-Z/a-z/ unless /^Make/' * + # rename '$_ .= ".bad"' *.f + # rename 'print "$_: "; s/foo/bar/ if =~ /^y/i' * + + $op = shift; + for (@ARGV) { + $was = $_; + eval $op; + die $@ if $@; + rename($was,$_) unless $was eq $_; + } + 10) Why do I get [some strange error message] when I "rsh host command" ? *************** *** 534,540 **** in their names. ! 16) What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss} stand for? awk = "Aho Weinberger and Kernighan" --- 584,611 ---- in their names. ! 16) How do I redirect stdout and stderr separately in csh? ! ! In csh, you can redirect stdout with ">", or stdout and stderr ! together with ">&" but there is no direct way to redirect ! stderr only. The best you can do is ! ! ( command >stdout_file ) >&stderr_file ! ! which runs "command" in a subshell; stdout is redirected inside ! the subshell to stdout_file, and both stdout and stderr from the ! subshell are redirected to stderr_file, but by this point stdout ! has already been redirected so only stderr actually winds up in ! stderr_file. ! ! 17) How do I set the permissions on a symbolic link? ! ! Permissions on a symbolic link don't really mean anything. The ! only permissions that count are the permissions on the file that ! the link points to. ! ! ! 18) What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss} stand for? awk = "Aho Weinberger and Kernighan" *************** *** 618,632 **** biff = "biff" ! This command, which turns on asynchronous mail notification, ! was allegedly named after someone's dog that barked whenever ! the postman arrived. Or so the story goes. ! ! ! Don Libes' book "Life with Unix" contains lots more of ! these tidbits. ! 17) How do I pronounce "vi" ? You can start a very long and pointless discussion by wondering about this topic on the net. Some people say "vye", some say --- 689,711 ---- biff = "biff" ! This command, which turns on asynchronous mail notification, ! was actually named after a dog at Berkeley. ! ! I can confirm the origin of biff, if you're interested. Biff ! was Heidi Stettner's dog, back when Heidi (and I, and Bill Joy) ! were all grad students at U.C. Berkeley and the early versions ! of BSD were being developed. Biff was popular among the ! residents of Evans Hall, and was known for barking at the ! mailman, hence the name of the command. ! ! Confirmation courtesy of Eric Cooper, Carnegie Mellon ! University ! ! Don Libes' book "Life with Unix" contains lots more of these ! tidbits. ! 19) How do I pronounce "vi" , or "!", or "/*", or ...? You can start a very long and pointless discussion by wondering about this topic on the net. Some people say "vye", some say *************** *** 638,643 **** --- 717,865 ---- and that there are lots of ways to say "#" or "/*" or "!" or "tty" or "/etc". No one pronunciation is correct - enjoy the regional dialects and accents. + + Since this topic keeps coming up on the net, here is a comprehensive + pronunciation list that has made the rounds in the past. + Origin unknown - please let me know if you know where it came from, + and I'll attribute it properly. + + + Names derived from UNIX are marked with *, names derived from C are marked + with +, and names deserving futher explanation are marked with a #. The + explanations will be given at the very end. + + ------------------------------------------------------------------------------ + -- SINGLE CHARACTERS -- + + SPACE, blank + + ! EXCLAMATION POINT, exclamation mark, exclamation, exclam, excl, clam, + bang#, shout, yell, shriek, pling, factorial, ball-bat, smash, cuss, + wow, hey, boing + + " QUOTATION MARK, quote, double quote, dirk, literal mark, rabbit ears, + double ping, double glitch + + # CROSSHATCH, pound, pound sign, number, number sign, sharp, octothorpe#, + hash, fence, crunch, mesh, hex, flash, grid, pig-pen, tictactoe, + scratch, scratch mark, gardengate, gate, hak, oof, rake, sink + + $ DOLLAR SIGN, dollar, cash, currency symbol, buck, string#, escape#, + ding, big-money + + % PERCENT SIGN, percent, mod+, shift-5, double-oh-seven, grapes + + & AMPERSAND, and, amper, address+, shift-7, andpersand, snowman, + bitand+, donald duck#, daemon + + ' APOSTROPHE, single quote, quote, tick, prime, irk, pop, spark, glitch + + * ASTERISK, star, splat, spider, aster, times, wildcard*, gear, dingle, + (Nathan) Hale#, bug, gem, twinkle + + () PARENTHESES, parens, round brackets, bananas, ears, bowlegs, + parenthesee (singular only), weapons + ( LEFT PARENTHESIS, paren, so, wax, parenthesee, open, sad + ) RIGHT PARENTHESIS, thesis, already, wane, unparenthesee, close, happy + + + PLUS SIGN, plus, add, cross, and, intersection, and + + , COMMA, tail + + - HYPHEN, minus, minus sign, dash, dak, option, flag, negative, + negative sign, worm, bithorpe# + + . PERIOD, dot, decimal, decimal point, radix point, point, spot, full stop, + put#, floor + + / SLASH, stroke, virgule, solidus, slant, diagonal, over, slat, slak, + across#, compress#, spare + + : COLON, two-spot, double dot, dots + + ; SEMICOLON, semi, hybrid + + <> ANGLE BRACKETS, angles, funnels, brokets + < LESS THAN, less, read from*, from*, in*, comesfrom*, crunch, + sucks + > GREATER THAN, more, write to*, into/toward*, out*, gazinta*, zap, + blows + + = EQUAL SIGN, equals, equal, gets, quadrathorpe#, half-mesh + + ? QUESTION MARK, question, query, whatmark, what, wildchar*, huh, ques, + kwes, quiz, quark, hook + + @ AT SIGN, at, each, vortex, whorl, whirlpool, cyclone, snail, ape, cat, + snable-a#, trunk-a#, rose, cabbage, Mercantile symbol + + [] BRACKETS, square brackets, U-turns, edged parentheses, mimics + [ LEFT BRACKET, bracket, bra, square, opensquare + ] RIGHT BRACKET, unbracket, ket, unsquare, close + + \ BACKSLASH, reversed virgule, bash, backslant, backwhack, backslat, + escape*, backslak, bak, reduce# + + ^ CIRCUMFLEX, caret, carrot, hat, cap, uphat, party hat, housetop, + up arrow, control, boink, chevron, hiccup, to-the, fang, sharkfin, + and#, xor+, wok, trap + + _ UNDERSCORE, underline, underbar, under, score, backarrow, flatworm, blank + + ` GRAVE, grave accent, accent, backquote, left/open quote, backprime, + unapostrophe, backspark, birk, blugle, backtick, push, backglitch, + backping + + {} BRACES, curly braces, squiggly braces, curly brackets, squiggle brackets, + Tuborgs#, ponds + { LEFT BRACE, brace, curly, leftit, embrace, openbrace, begin+ + } RIGHT BRACE, unbrace, uncurly, rytit, bracelet, close, end+ + + | VERTICAL BAR, pipe*, pipe to*, vertical line, broken line#, bar, or+, + bitor+, vert, v-bar, spike, to*, gazinta*, thru*, pipesinta*, tube, + mark, whack, gutter, wall + + ~ TILDE, twiddle, tilda, tildee, wave, squiggle, swung dash, approx, + wiggle, enyay#, home*, worm + + + -- MULTIPLE CHARACTER STRINGS -- + + !? interrobang (one overlapped character) + /* slashterix+ + */ asterslash+ + >> appends*, cat-astrophe + -> arrow+, pointer to+, hiccup+ + #! sh'bang, wallop + \!* bash-bang-splat + () nil# + && and+, amper-amper, succeeds-then* + || or+, fails-then* + + + -- NOTES -- + + ! bang comes from old card punch phenom where punching ! code made a + loud noise + # octothorpe from Bell System + $ string from BASIC + $ escape from TOPS-10 + & donald duck from the Danish "Anders And", which means "Donald Duck" + * splat from DEC "spider" glyph + * Nathan Hale "I have but one asterisk for my country." + = quadrathorpe half an octothorpe + - bithorpe half a quadrathorpe (So what's a monothorpe?) + . put Victor Borge on Electric Company + / across APL + / compress APL + @ snable-a from Danish; may translate as "trunk-a" + @ trunk-a "trunk" = "elephant nose" + ^ and from formal logic + \ reduce APL + {} Tuborgs from advertizing for well-known Danish beverage + | broken line EBCDIC has two vertical bars, one solid and one broken. + ~ enyay from the Spanish n-tilde + () nil LISP --