wfmans@ihuxb.UUCP (w. mansfield) (05/10/85)
> ... > When I first got my home computer, I made the mistake of naming a > temporary file "test" while logged in as root, and then discovered I > couldn't shut down the machine until I removed it. Seems that part of > the shutdown procedure is writing a file named "test," and if there's already > one of that name, it just logs you in again. > > --Lee Gold This reminds me of my usual mistake -- under UNIX, create a program test.c, compile it using make into test, and try to execute it. You get no output very quickly, since test is part of the shell. Hard to debug, too, since you can't find another executable file in your PATH. I added net.unix to the list. Seems a far better place for these digressions. -- Bill Mansfield AT&T Information Systems, Naperville, IL {ihnp4!}ihuxb!wfmans
philipl@azure.UUCP (Philip Lantz) (05/11/85)
> This reminds me of my usual mistake -- under UNIX, create a program > test.c, compile it using make into test, and try to execute it. > You get no output very quickly, since test is part of the shell. > Hard to debug, too, since you can't find another executable file > in your PATH. > Bill Mansfield On what UNIX systems (or what shells) is test part of the shell? On every system (and shell) I've used, it's in /bin/test. prl
long@ittvax.UUCP (H. Morrow Long [Systems Center]) (05/15/85)
> On what UNIX systems (or what shells) is test part of the shell? On > every system (and shell) I've used, it's in /bin/test. > > prl /bin/test will probably always be there but in the SysV R2 Bourne shell 'test' is a builtin. -- H. Morrow Long ITT-ATC Systems Center, 1 Research Drive Shelton, CT 06484 Phone #: (203)-929-7341 x. 634 path = {allegra bunker ctcgrafx dcdvaxb dcdwest ucbvax!decvax duke eosp1 ittral lbl-csam milford mit-eddie psuvax1 purdue qubix qumix research sii supai tmmnet twg uf-cgrl wxlvax yale}!ittvax!long
guy@sun.uucp (Guy Harris) (05/15/85)
> This reminds me of my usual mistake -- under UNIX, create a program > test.c, compile it using make into test, and try to execute it. > You get no output very quickly, since test is part of the shell. > Hard to debug, too, since you can't find another executable file > in your PATH. In the System V Release 2 shell, you can do "type test" which will tell you what type of command "test" is (and, if it's an executable program or script, what the full pathname is). Useful for this kind of thing. Guy Harris
gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/15/85)
> On what UNIX systems (or what shells) is test part of the shell? On > every system (and shell) I've used, it's in /bin/test. It's also built into all modern shells (e.g., SV Bourne, Korn). Not only that, but most experienced users put the current directory LAST in their $PATH to avoid unpleasant surprises while browsing, or leave it out of the $PATH altogether (then type "./myprog" to run "myprog" in the current directory), so that /bin/test would still get executed instead of the local directory's "test".
guy@sun.uucp (Guy Harris) (05/18/85)
> > On what UNIX systems (or what shells) is test part of the shell? On > > every system (and shell) I've used, it's in /bin/test. > /bin/test will probably always be there but in the SysV R2 Bourne > shell 'test' is a builtin. It's a builtin in System III and System V (release 1 and 2). It probably was a builtin in UNIX/TS 1.0 and PWB/UNIX 2.0 (the predecessors to System III). System V doesn't have "/bin/test" because it doesn't need it. There is also a stub of code in the V7 shell (which is the 4.xBSD shell as well) to have "test" be a builtin under the name "[". In the TS 1.0/PWB 2.0/S3/S5 shell, it's builtin under the name "[" as well as "test". Furthermore, if you do ln /bin/test /bin/[ under V7, you can call it "[" as well; 4.xBSD comes with this already done. That way, you can write if [ -f /etc/foo ] instead of if test -f /etc/foo which, arguably, looks cleaner. Building it into the shell makes scripts which do lots of "test"s run much faster. Guy Harris
wfmans@ihuxb.UUCP (w. mansfield) (05/21/85)
> > > On what UNIX systems (or what shells) is test part of the shell? On > > > every system (and shell) I've used, it's in /bin/test. > > > /bin/test will probably always be there but in the SysV R2 Bourne > > shell 'test' is a builtin. > > It's a builtin in System III and System V (release 1 and 2). It probably > was a builtin in UNIX/TS 1.0 and PWB/UNIX 2.0 (the predecessors to System > III). System V doesn't have "/bin/test" because it doesn't need it. There > is also a stub of code in the V7 shell (which is the 4.xBSD shell as well) > to have "test" be a builtin under the name "[". In the TS 1.0/PWB 2.0/S3/S5 > shell, it's builtin under the name "[" as well as "test". Furthermore, if > you do > > ln /bin/test /bin/[ > > under V7, you can call it "[" as well; 4.xBSD comes with this already done. > That way, you can write > > if [ -f /etc/foo ] > > instead of > > if test -f /etc/foo > > which, arguably, looks cleaner. > > Building it into the shell makes scripts which do lots of "test"s run much > faster. > > Guy Harris AIIIIIIEEEEE! I'm sorry I started a UNIX dialogue in net.nlang. If there's interest, let's move the discussion to net.unix only, and leave the language au natural folks alone. -- Bill Mansfield AT&T Information Systems, Naperville, IL {ihnp4!}ihuxb!wfmans