Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!ukc!its63b!simon From: simon@its63b.ed.ac.uk (Simon Brown) Newsgroups: comp.unix.wizards Subject: Re: symbolic links and csh execution Message-ID: <500@its63b.ed.ac.uk> Date: Thu, 25-Jun-87 07:20:31 EDT Article-I.D.: its63b.500 Posted: Thu Jun 25 07:20:31 1987 Date-Received: Sat, 4-Jul-87 17:34:51 EDT References: > <2211@bunker.UUCP> <1097@mtune.ATT.COM> <21681@sun.uucp> Reply-To: simon@its63b.ed.ac.uk (Simon Brown) Organization: Computer Science Department, Edinburgh University Lines: 53 In article <21681@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes: >The intent behind "#!" was to permit *arbitrary* interpreters to run >programs, not just shells. (It also permits interpreted programs to >be set-UID, assuming you trust the interpreter's mechanisms to the >degree necessary to make set-UID interpeted programs safe. Prior to >4.3BSD, there were two very large security holes that rendered >set-UID shell scripts, at least, unsafe; those two holes were closed >in 4.3BSD, but there could well be others.) > >Huh? How does "#!" "automagically" support "...a language processor >which is a partial superset of an existing standard"? What it >supports is executing shell scripts as ordinary programs *without* >having to ensure that all programs that might try to execute that >script use "exec[lv]p" instead of "exec[lv]". The latter is somewhat >nice, considering that not all programs *do* use "exec[lv]p". > Unfortunately, execution of a "program" only makes sense from within an interpreter environment (such as sh, csh, ...). After all, the command "/bin/cat" that gets executed by a "#!/bin/cat" interpreter could have widely different interpretations depending on who is executing it. Luckily, all shells treat pathname-commands as being "execv that pathname", but this does limit the sort of commands that may be issued via a #! directive. I would quite like to use pipes, i/o redirection, shell-variables, etc... in a #! - for example #!(sed 1d | tbl | nroff -ms | lpr) .PP Hello. .TS a table .TE [etc...] in a file, to automatically run its contents through "tbl" and "nroff" and print out the result, whenever the file is executed. But there is no provision for this sort of syntax in a #!, which is a pity. I guess ``#!/bin/sh -c "sed -d $1 | tbl | nroff -ms | lpr"'' might work, but this is very ugly. %{ Simon. %} -- ---------------------------------- | Simon Brown | UUCP: seismo!mcvax!ukc!its63b!simon | Department of Computer Science | JANET: simon@uk.ac.ed.its63b | University of Edinburgh, | ARPA: simon%its63b.ed.ac.uk@cs.ucl.ac.uk | Scotland, UK. | ---------------------------------- "Life's like that, you know"