Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.wizards Subject: Re: How does Unix kernel find /bin/sh? Keywords: #!/bin/sh Message-ID: <10851@smoke.BRL.MIL> Date: 28 Aug 89 08:26:54 GMT References: <5@minya.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <5@minya.UUCP> jc@minya.UUCP (John Chambers) writes: >the "#!" notation. You'd think by now that everyone would realize >what a Good Idea this is, and it'd have been installed everywhere. I think it's slated for SVR4.0. However, not everyone agrees that it's a Good Thing. It causes problems when porting scripts across systems, because the various interpreter utilities may not have identical pathnames across systems. Also, some of us have relied on System V NOT understanding the #! convention, and our scripts will break when SVR4.0 arrives. >The problem is simple: when I exec a script directly, the kernel >doesn't run /bin/sh, it runs /bin/bsh! No, it's run under whatever shell you're already running. The shell forks a subshell to handle the script, after the direct exec() system call fails. >I've yet to see any mention of the "#!" notation in any document anywhere; It's documented in the 4.3BSD PRM under EXECVE(2).