Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!ames!oliveb!pyramid!prls!mips!dce From: dce@mips.UUCP (David Elliott) Newsgroups: comp.unix.wizards Subject: Re: #! magic number Message-ID: <488@quacky.UUCP> Date: Mon, 29-Jun-87 09:26:48 EDT Article-I.D.: quacky.488 Posted: Mon Jun 29 09:26:48 1987 Date-Received: Tue, 30-Jun-87 06:28:33 EDT References: > <2211@bunker.UUCP> <1097@mtune.ATT.COM> <7180@mimsy.UUCP> <1788@ttrdc.UUCP> Reply-To: dce@quacky.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 47 In article <1788@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: >In article <7180@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: >< And indeed, it does more: >< % egrep uucp:: /etc/passwd >< uucp::16:16:UNIX-to-UNIX Copy:/usr/spool/uucppublic:/usr/lib/uucp/recording >< % cat /usr/lib/uucp/recording >< #! /bin/awk NR > 1 { print } >< [message] >This is like using a cannon to kill a gopher. >Why not > >/bin/cat << ! > [message] >! >which will also work on systems other than "Berserkeley" UNIX. What? You mean that your /etc/password will allow you to put multiple lines in the shell field? What you suggest is that uucp::16:..:/bin/cat << ! [message] is a valid entry in the password file. The point was that with #! you can use shell scripts or any other scripts as login shells or anywhere an executable program can go. Sure, you could say #!/bin/sh /bin/cat << ! [message] ! and have it work, but you could not simply say /bin/cat << ! [message] ! and have it work unless login(1) executes the script vi sh. The fact that #!/bin/awk or #!/bin/sed or #!/usr/ucb/tail +2 will work is due to the generality of the #!, and generality is a big win. -- David Elliott {decvax,ucbvax,ihnp4}!decwrl!mips!dce