[comp.unix.internals] Diffs to the Frequently Asked Questions postings

sahayman@iuvax.cs.indiana.edu (Steve Hayman) (10/02/90)

Here are the most recent changes to parts 1 and 2 of the
Frequently Asked Questions articles, which have just been
posted.  You can find the full articles elsewhere in
comp.unix.questions and comp.unix.wizards.  You can also ftp
the most recent version from iuvax.cs.indiana.edu (129.79.254.192),
where it's "pub/Unix-Questions.part1" and "pub/Unix-Questions.part2".

*** /tmp/,RCSt1a08685	Mon Oct  1 14:37:14 1990
--- part1	Mon Oct  1 14:36:42 1990
***************
*** 1,12 ****
  Subject: Welcome to comp.unix.questions and comp.unix.wizards [Monthly posting]
  
! [Last changed: $Date: 90/09/05 22:12:04 $ by $Author: sahayman $]
  
! NOTE - much of this information needs to be changed since a number
! of new comp.unix subgroups have been created.  I haven't had time to
! make the necessary updates yet.  Take much of this posting with a 
! grain of salt at the moment.
!    ... steve hayman, sept. 5 1990
  
  Comp.unix.questions and comp.unix.wizards are two of the most popular
  and highest volume newsgroups on Usenet.  This article is a monthly
--- 1,13 ----
  Subject: Welcome to comp.unix.questions and comp.unix.wizards [Monthly posting]
  
! [Last changed: $Date: 90/10/01 14:36:34 $ by $Author: sahayman $]
  
! [NOTE - I'm waiting for the fuss over comp.unix.{wizards,internals,esoterica}
!  to settle down.  Until that happens, I'm going to continue to post these
!  two documents to "comp.unix.questions" and "comp.unix.wizards"; you may be
!  reading this in "comp.unix.internals" if someone upstream from you
!  is aliasing ".wizards" to ".internals".    ...Steve Hayman, Oct. 1/1990 ]
! 
  
  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/,RCSt1a08724	Mon Oct  1 14:37:21 1990
--- part2	Mon Oct  1 14:37:04 1990
***************
*** 1,6 ****
  Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting]
  
! [Last changed: $Date: 90/09/05 22:12:09 $ 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
--- 1,6 ----
  Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting]
  
! [Last changed: $Date: 90/10/01 14:36:47 $ 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
***************
*** 43,49 ****
  	21) How do I "undelete" a file?
  	22) How can a process detect if it's running in the background?
  	23) How can an executing program determine its own pathname?
! 	24) How do I pronounce "vi" , or "!", or "/*", or ...?
  
  
      If you're looking for the answer to, say, question 14, and want to skip
--- 43,52 ----
  	21) How do I "undelete" a file?
  	22) How can a process detect if it's running in the background?
  	23) How can an executing program determine its own pathname?
! 	24) How do I tell inside .cshrc if I'm a login shell?
! 	25) Why doesn't redirecting a loop work as intended?  (Bourne shell)
! 	26) How do I use popen() to open a process for reading AND writing?
! 	27) How do I pronounce "vi" , or "!", or "/*", or ...?
  
  
      If you're looking for the answer to, say, question 14, and want to skip
***************
*** 397,406 ****
  
  	ls -d *.foo | sed -e 's/.*/mv & &/' -e 's/foo$/bar/' | sh
  
!     A program called "ren" that does this job nicely was posted
!     to comp.sources.unix some time ago.  It lets you use
  
! 	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
--- 400,410 ----
  
  	ls -d *.foo | sed -e 's/.*/mv & &/' -e 's/foo$/bar/' | sh
  
!     A program by Vladimir Lanin called "mmv" that does this job nicely
!     was posted to comp.sources.unix (Volume 21, issues 87 and 88) in
!     April 1990.  It lets you use
  
! 	mmv '*.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
***************
*** 414,420 ****
--- 418,431 ----
  	    for f in *; do
  		mv $f `echo $f | tr '[A-Z]' '[a-z]'`
  	    done
+ 	Korn Shell:
+ 	    typeset -l l
+ 	    for f in *; do
+ 		l=f
+ 		mv $f $l
+ 	    done
  
+ 
      If you wanted to be really thorough and handle files with
      `funny' names (embedded blanks or whatever) you'd need to use
      
***************
*** 984,990 ****
      but of course this is just a hypothetical example, don't
      try it yourself :-)
      
! 24) 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
      "vee-eye" (the vi manual suggests this) and some Roman numerologists
--- 995,1090 ----
      but of course this is just a hypothetical example, don't
      try it yourself :-)
      
! 24) How do I tell inside .cshrc if I'm a login shell?
! 
!     Here's one way, courtesy of Maarten Litmaath:
! 
!     # .cshrc
! 
!     if (! $?CSHLEVEL) then
!             setenv      CSHLEVEL        0
!             set home = ~username        # just to be sure
!             source ~/.env               # environment stuff we always want
!     else
!             set tmp = $CSHLEVEL
!             @ tmp++
!             setenv      CSHLEVEL        $tmp
!     endif
! 
!     # exit from .cshrc if not interactive, e.g. under rsh (BSD)
!     if (! $?prompt) exit
! 
!     # aliases
!     # set variables
! 
!     ----------------------------------------
! 
!     # .env
! 
!     # umask
!     # setenv variables
! 
!     ----------------------------------------
! 
!     # .login
! 
!     # terminal setup
!     # startup favourite window environment
! 
! 25) Why doesn't redirecting a loop work as intended?  (Bourne shell)
! 
!     Take the following example:
! 
! 	foo=bar
! 
! 	while read line
! 	do
! 		# do something with $line
! 		foo=bletch
! 	done < /etc/passwd
! 
! 	echo "foo is now: $foo"
! 
!     Despite the assignment ``foo=bletch'' this will print ``foo is now: bar''
!     in many implementations of the Bourne shell.  Why?
!     Because of the following, often undocumented, feature of historic
!     Bourne shells: redirecting a control structure (such as a loop, or an
!     ``if'' statement) causes a subshell to be created, in which the structure
!     is executed; variables set in that subshell (like the ``foo=bletch''
!     assignment) don't affect the current shell, of course.
! 
!     The POSIX 1003.2 Shell and Tools Interface standardization committee
!     forbids the behaviour described above, i.e. in P1003.2 conformant
!     Bourne shells the example will print ``foo is now: bletch''.
! 
!     Take the next example:
! 
! 	foo=bar
! 
! 	echo bletch | read foo
! 
! 	echo "foo is now: $foo"
! 
!     This will print ``foo is now: bar'' in many implementations,
!     ``foo is now: bletch'' in some others.  Why?
!     Generally each part of a pipeline is run in a different subshell;
!     in some implementations though, the last command in the pipeline is
!     made an exception: if it is a builtin command like ``read'', the current
!     shell will execute it, else another subshell is created.
! 
!     Draft 9 of POSIX 1003.2 allows both behaviours; future drafts may
!     explicitly specify only one of them though.
! 
! 26) How do I use popen() to open a process for reading AND writing?
!     
!     The problem with trying to pipe both input and output to an arbitrary
!     slave process is that deadlock can occur, if both processes are waiting
!     for not-yet-generated input at the same time.  Deadlock can be avoided
!     only by having BOTH sides follow a strict deadlock-free protocol, but
!     since that requires cooperation from the processes it is inappropriate
!     for a popen()-like library function.
! 
! 27) 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
      "vee-eye" (the vi manual suggests this) and some Roman numerologists
***************
*** 997,1010 ****
      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.  Send updates
!     to Steve Hayman, sahayman@cs.indiana.edu.  Special thanks to
!     Maarten Litmaath for his work in maintaining this list in the past.
  
- 
  			The Pronunciation Guide
  			-----------------------
! 			      version 2.2
  
  Names derived from UNIX are marked with *, names derived from C are marked
  with +, names derived from (Net)Hack are marked with & and names deserving
--- 1097,1109 ----
      dialects and accents.  
  
      Since this topic keeps coming up on the net, here is a comprehensive
!     pronunciation list that has made the rounds.  Send updates to
!     Steve Hayman, sahayman@cs.indiana.edu.  Special thanks to Maarten
!     Litmaath for his work in maintaining this list in the past.
  
  			The Pronunciation Guide
  			-----------------------
! 			      version 2.3
  
  Names derived from UNIX are marked with *, names derived from C are marked
  with +, names derived from (Net)Hack are marked with & and names deserving
***************
*** 1076,1086 ****
  =    EQUAL SIGN, equal(s), gets, becomes, quadrathorpe#, half-mesh, ring&
  
  ?    QUESTION MARK, question, query, whatmark, what, wildchar*, huh, ques,
! 	kwes, quiz, quark, hook, scroll&
  
! @    AT SIGN, at, each, vortex, whirl, whirlpool, cyclone, snail, ape, cat,
! 	snable-a#, trunk-a#, rose, cabbage, Mercantile symbol, strudel#,
! 	fetch#, shopkeeper&, human&, commercial-at
  
  []   BRACKETS, square brackets, U-turns, edged parentheses
  [    LEFT BRACKET,  bracket,   bra, (left) square (brack[et]),   opensquare,
--- 1175,1185 ----
  =    EQUAL SIGN, equal(s), gets, becomes, quadrathorpe#, half-mesh, ring&
  
  ?    QUESTION MARK, question, query, whatmark, what, wildchar*, huh, ques,
! 	kwes, quiz, quark, hook, scroll&, interrogation point
  
! @    AT SIGN, at, each, vortex, whirl, whirlpool, cyclone, snail, ape (tail),
! 	cat, snable-a#, trunk-a#, rose, cabbage, Mercantile symbol, strudel#,
! 	fetch#, shopkeeper&, human&, commercial-at, monkey (tail)
  
  []   BRACKETS, square brackets, U-turns, edged parentheses
  [    LEFT BRACKET,  bracket,   bra, (left) square (brack[et]),   opensquare,
***************
*** 1097,1103 ****
  	sharkfin, and#, xor+, wok, trap&, pointer#, pipe*, upper-than#
  
  _    UNDERSCORE, underline, underbar, under, score, backarrow, flatworm, blank,
! 	chain&, gets#, dash#
  
  `    GRAVE, (grave/acute) accent, backquote, left/open quote, backprime, 
  	unapostrophe, backspark, birk, blugle, backtick, push, backglitch,
--- 1196,1202 ----
  	sharkfin, and#, xor+, wok, trap&, pointer#, pipe*, upper-than#
  
  _    UNDERSCORE, underline, underbar, under, score, backarrow, flatworm, blank,
! 	chain&, gets#, dash#, sneak
  
  `    GRAVE, (grave/acute) accent, backquote, left/open quote, backprime, 
  	unapostrophe, backspark, birk, blugle, backtick, push, backglitch,
***************
*** 1215,1221 ****
  | broken line	EBCDIC has two vertical bars, one solid and one broken.
  ~ enyay		from the Spanish n-tilde
  () nil		LISP
- 
  -- 
  Steve Hayman    Workstation Manager    Computer Science Department   Indiana U.
  sahayman@iuvax.cs.indiana.edu                                    (812) 855-6984
--- 1314,1319 ----