Diffs to the Frequently Asked Questions postings

Steve Hayman sahayman at iuvax.cs.indiana.edu
Sat Mar 2 09:10:54 AEST 1991


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.  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".
(IUVax also runs a mail server, for those of you unable to ftp.
 Send the line "HELP" to "mailserv at iuvax.cs.indiana.edu" to get started.)


The main difference this month is that I've retired the
"Pronunciation Guide", since it's now a part of the
widely-distributed "jargon" file.

*** /tmp/,RCSt1a03079	Fri Mar  1 17:04:56 1991
--- part1	Fri Mar  1 17:02:46 1991
***************
*** 1,6 ****
  Subject: Welcome to comp.unix.questions [Monthly posting]
  
! [Last changed: $Date: 91/02/04 12:11:02 $ by $Author: sahayman $]
  
  
  Comp.unix.questions is one of the most popular and highest volume
--- 1,6 ----
  Subject: Welcome to comp.unix.questions [Monthly posting]
  
! [Last changed: $Date: 91/03/01 17:02:39 $ by $Author: sahayman $]
  
  
  Comp.unix.questions is one of the most popular and highest volume
***************
*** 94,99 ****
--- 94,100 ----
  comp.unix               Discussion of UNIX* features and bugs. (Moderated)
  comp.unix.admin         Administering a Unix-based system.
  comp.unix.aix           IBM's version of UNIX.
+ comp.unix.amiga		Unix on the Commodore Amiga
  comp.unix.aux           The version of UNIX for Apple Macintosh II computers.
  comp.unix.internals     Discussions on hacking UNIX internals.
  comp.unix.large         UNIX on mainframes and in large networks.
*** /tmp/,RCSt1a03126	Fri Mar  1 17:05:17 1991
--- part2	Fri Mar  1 17:04:18 1991
***************
*** 1,6 ****
  Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting]
  
! [Last changed: $Date: 91/02/04 12:11:11 $ by $Author: sahayman $]
  
  This article contains the answers to some Frequently Asked Questions
  often seen in comp.unix.questions.  Please don't ask these questions
--- 1,6 ----
  Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting]
  
! [Last changed: $Date: 91/03/01 17:04:08 $ by $Author: sahayman $]
  
  This article contains the answers to some Frequently Asked Questions
  often seen in comp.unix.questions.  Please don't ask these questions
***************
*** 11,16 ****
--- 11,17 ----
  
  This article includes answers to:
  
+ 	0)  Who helped you put this list together?
  	1)  How do I remove a file whose name begins with a "-" ?
  	2)  How do I remove a file with funny characters in the filename ?
  	3)  How do I get a recursive directory listing?
***************
*** 55,61 ****
  	31) How do I construct a shell glob-pattern that matches all files
  	    except "." and ".." ?
  	32) How do I find the last argument in a Bourne shell script?
! 	33) How do I pronounce "vi" , or "!", or "/*", or ...?
  
  
      If you're looking for the answer to, say, question 14, and want to skip
--- 56,65 ----
  	31) How do I construct a shell glob-pattern that matches all files
  	    except "." and ".." ?
  	32) How do I find the last argument in a Bourne shell script?
! 	33) How can I find out which user or process has a file open or is using
! 	    a particular file system (so that I can unmount it?)
! 	34) What happened to the pronunciation list that used to be
! 	    part of this document?
  
  
      If you're looking for the answer to, say, question 14, and want to skip
***************
*** 75,80 ****
--- 79,91 ----
  corrections for any of these answers, please send them to to
  sahayman at iuvax.cs.indiana.edu or iuvax!sahayman.
  
+ 0)  Who helped you put this list together?
+ 
+ I owe a great deal of thanks to dozens of Usenet readers who submitted
+ questions, answers, corrections and suggestions for this list.  I'd
+ especially like to thank Maarten Litmaath and Guy Harris, who have both
+ made many especially valuable contributions.
+ 
  1)  How do I remove a file whose name begins with a "-" ?
  
      Figure out some way to name the file so that it doesn't
***************
*** 95,102 ****
      
  2)  How do I remove a file with funny characters in the filename ?
  
!     The  classic answers are
  
  	rm -i some*pattern*that*matches*only*the*file*you*want
  
  	which asks you whether you want to remove each file matching
--- 106,118 ----
      
  2)  How do I remove a file with funny characters in the filename ?
  
!     If the 'funny character' is a '/', skip to the last part of
!     this answer.  If the funny character is something else,
!     such as a ' ' or control character or character with
!     the 8th bit set, keep reading.
  
+     The classic answers are
+ 
  	rm -i some*pattern*that*matches*only*the*file*you*want
  
  	which asks you whether you want to remove each file matching
***************
*** 139,144 ****
--- 155,246 ----
      that the filename may contain a funny character sequence that will mess
      up your screen when printed.
  
+ 
+     What if the filename has a '/' in it?
+ 
+     These files really are special cases, and can only be created
+     by buggy kernel code (typically by implementations of NFS
+     that don't filter out illegal characters in file names from
+     remote machines.)  The first thing to do is to try to
+     understand exactly why this problem is so strange.
+ 
+     Recall that Unix directories are simply pairs of
+     filenames and inode numbers.  A directory essentially
+     contains information like this:
+ 
+ 	filename  inode
+ 
+ 	file1	  12345
+ 	file2.c	  12349
+ 	file3     12347
+ 
+     Theoretically, '/' and '\0' are the only two characters that
+     cannot appear in a filename - '/' because it's used to separate
+     directories and files, and '\0' because it terminates a filename.
+ 
+     Unfortunately some implementations of NFS will blithely create
+     filenames with embedded slashes in response to requests from remote
+     machines.  For instance, this could happen when someone on a Mac or
+     other non-Unix machine decides to create a remote NFS file on
+     your Unix machine with the date in the filename.  Your Unix
+     directory then has this in it:
+ 
+ 	filename  inode
+ 
+ 	91/02/07  12357
+     
+     No amount of messing around with 'find' or 'rm' as described above
+     will delete this file, since those utilities and all other Unix
+     programs, are forced to interpret the '/' in the normal way. 
+ 
+     Any ordinary program will eventually try to do unlink("91/02/07"),
+     which as far as the kernel is concerned means "unlink the file 07
+     in the subdirectory 02 of directory 91", but that's not what we
+     have - we have a *FILE* named "91/02/07" in the current directory.
+     This is a subtle but crucial distinction. 
+ 
+     What can you do in this case?  
+     The first thing to try is to return to the Mac that created this
+     crummy entry, and see if you can convince it and your local NFS
+     daemon to rename the file to something without slashes.
+ 
+     If that doesn't work or isn't possible, drastic action by root is
+     required.   Use "ls -i" to find the inode number of this bogus
+     file, then unmount the file system and use "clri" to clear the
+     inode, and "fsck" the file system with your fingers crossed.
+     This destroys the information in the file.  If you want to
+     keep it, you can try:
+     
+ 	create a new directory in the same parent directory as the
+ 	one containing the bad file name;
+ 
+ 	move everything you can (i.e. everything but the file with
+ 	the bad name) from the old directory to the new one;
+ 
+ 	do "ls -id" on the directory containing the file with the
+ 	bad name to get its inumber;
+ 
+ 	umount the file system;
+ 
+ 	"clri" the directory containing the file with the bad name;
+ 
+ 	"fsck" the file system.
+ 
+     Then, to find the file,
+ 
+ 	remount the file system;
+ 
+ 	rename the directory you created to have the name of
+ 	the old directory (since the old directory should have
+ 	been blown away by "fsck")
+ 
+ 	move the file out of "lost+found" into the directory
+ 	with a better name.
+ 
+     Alternatively, you can patch the directory the hard way
+     by crawling around in the raw file system.
+     Use "fsdb", if you have it.
+     
      If none of these work, find your system manager.
  
  3)  How do I get a recursive directory listing?
***************
*** 452,465 ****
  	Bourne Shell:
  
  	    for f in *; do
! 		eval mv '"$f"' \"`echo "$f" | tr '[A-Z]' '[a-z]'`\"
  	    done
      
!     (Some versions of "tr" require the [ and ], some don't.  It happens 
!      to be harmless to include them in this particular example; versions of
!      tr that don't want the [] will conveniently think they are supposed
!      to translate '[' to '[' and ']' to ']').
  
      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.
--- 554,572 ----
  	Bourne Shell:
  
  	    for f in *; do
!               g=`expr "xxx$f" : 'xxx\(.*\)' | tr '[A-Z]' '[a-z]'`
!               mv "$f" "$g"
! 
  	    done
      
!     The `expr' command will always print the filename, even if it equals`
!     `-n' or if it contains a System V escape sequence like `\c'.
  
+     Some versions of "tr" require the [ and ], some don't.  It happens 
+     to be harmless to include them in this particular example; versions of
+     tr that don't want the [] will conveniently think they are supposed
+     to translate '[' to '[' and ']' to ']'.
+ 
      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.
***************
*** 755,761 ****
      sections 3m, 3n, 3x and 3yp among others.
  
  
! 19) What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss}
      stand for?
  
      awk = "Aho Weinberger and Kernighan"
--- 862,868 ----
      sections 3m, 3n, 3x and 3yp among others.
  
  
! 19) What does {awk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bss,rc}
      stand for?
  
      awk = "Aho Weinberger and Kernighan"
***************
*** 853,858 ****
--- 960,983 ----
  	Confirmation courtesy of Eric Cooper, Carnegie Mellon
  	University
  
+     rc (as in ".cshrc" or "/etc/rc") = "RunCom"
+ 
+ 	"rc" derives from "runcom", from the MIT CTSS system, ca. 1965.
+ 
+ 	    'There was a facility that would execute a bunch of commands
+ 	    stored in a file; it was called "runcom" for "run commands",
+ 	    and the file began to be called "a runcom."
+ 
+ 	    "rc" in Unix is a fossil from that usage.'
+ 	
+ 	Brian Kernighan & Dennis Ritchie, as told to Vicki Brown
+ 
+ 
+ 	"rc" is also the name of the shell from the new Plan 9
+ 	operating system.
+ 
+ 
+ 
      Don Libes' book "Life with Unix" contains lots more of these
      tidbits.
  
***************
*** 865,873 ****
      There should be no difference in content between the
      mailing list and the newsgroup.   
  
! 	[Note: The newsgroup "comp.unix.wizards" was recently
! 	deleted, but the "Unix-Wizards" mailing list still exists.
! 	I'm not really sure how this is all going to sort itself out.]
  
      To get on or off either of these lists, send mail to
      Info-Unix-Request at brl.mil or Unix-Wizards-Request at brl.mil .
--- 990,999 ----
      There should be no difference in content between the
      mailing list and the newsgroup.   
  
! 	[Note: The newsgroup "comp.unix.wizards" was recently deleted,
! 	and even more recently resurrected; the "Unix-Wizards" mailing
! 	list still exists.  I'm not really sure how this is all going
! 	to sort itself out.]
  
      To get on or off either of these lists, send mail to
      Info-Unix-Request at brl.mil or Unix-Wizards-Request at brl.mil .
***************
*** 967,973 ****
      MIT's Project Athena has produced a comprehensive
      delete/undelete/expunge/purge package, which can serve as a
      complete replacement for rm which allows file recovery.  This
!     package was posted to comp.sources.unix (volume 18, issue 73).
  
  
  22) How can a process detect if it's running in the background?
--- 1093,1099 ----
      MIT's Project Athena has produced a comprehensive
      delete/undelete/expunge/purge package, which can serve as a
      complete replacement for rm which allows file recovery.  This
!     package was posted to comp.sources.misc (volume 17, issue 023-026)
  
  
  22) How can a process detect if it's running in the background?
***************
*** 1137,1144 ****
      made an exception: if it is a builtin command like ``read'', the current
      shell will execute it, else another subshell is created.
  
!     Draft 10 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?
      
--- 1263,1270 ----
      made an exception: if it is a builtin command like ``read'', the current
      shell will execute it, else another subshell is created.
  
!     POSIX 1003.2 allows both behaviours so portable scripts cannot depend
!     on any of them.
  
  26) How do I use popen() to open a process for reading AND writing?
      
***************
*** 1415,1421 ****
  	     this includes the special entries "." and "..",
  	     which often you don't want;
  
!     .[^.]*   (Newer shells only)  
  	     Matches all files that begin with a "." and are
  	     followed by a non-"."; unfortunately this will miss
  	     "..foo";
--- 1541,1548 ----
  	     this includes the special entries "." and "..",
  	     which often you don't want;
  
!     .[!.]*   (Newer shells only; some shells use a "^" instead of
! 	     the "!"; POSIX shells must accept the "!")  
  	     Matches all files that begin with a "." and are
  	     followed by a non-"."; unfortunately this will miss
  	     "..foo";
***************
*** 1440,1446 ****
  
      Answer by:
  	Martin Weitzel <@mikros.systemware.de:martin at mwtech.uucp>
! 	Maarten Litmaath <maart at cs.vu.nl>
  
      If you are sure the number of arguments is at most 9, you can use:
  
--- 1567,1573 ----
  
      Answer by:
  	Martin Weitzel <@mikros.systemware.de:martin at mwtech.uucp>
! 	Maarten Litmaath <maart at nat.vu.nl>
  
      If you are sure the number of arguments is at most 9, you can use:
  
***************
*** 1522,1528 ****
      To reverse the arguments there is still a simpler method, that even does
      not create subprocesses.  This approach can also be taken if you want
      to delete e.g. the last argument, but in that case you cannot refer
!     directly to the N-th argument anymore, because the `argvN' variables are
      set up in reverse order:
  
  	argv=
--- 1649,1655 ----
      To reverse the arguments there is still a simpler method, that even does
      not create subprocesses.  This approach can also be taken if you want
      to delete e.g. the last argument, but in that case you cannot refer
!     directly to the N-th argument any more, because the `argvN' variables are
      set up in reverse order:
  
  	argv=
***************
*** 1537,1774 ****
  	eval set x "$argv"
  	shift
  
! 33) 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
-     say "six".  How you pronounce "vi" has nothing to do with whether
-     or not you are a true Unix wizard.
- 
-     Similarly, you'll find that some people pronounce "char" as "care",
-     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.  Send updates to
-     Steve Hayman, sahayman at cs.indiana.edu.  Special thanks to Maarten
-     Litmaath for his work in maintaining this list in the past.
- 



More information about the Comp.unix.questions mailing list