Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!umd5!brl-adm!adm!dsill@nswc-oas.arpa From: dsill@nswc-oas.arpa (Dave Sill) Newsgroups: comp.unix.wizards Subject: #! gotcha Message-ID: <13153@brl-adm.ARPA> Date: 27 Apr 88 21:22:53 GMT Sender: news@brl-adm.ARPA Lines: 22 I ran into a good one yesterday. A shell script was, for some reason, running under a restricted shell depending upon whether the file name of the script contained an 'r'. This only occurred when the script was run directly; typing `sh bar' worked fine. It turns out the Bourne shell looks for an 'r' anywhere in argv[0] and runs restricted if it finds one. Well, that seems ok. After all, we don't usually rename the shell. Unfortunately, when #! magic is used to specify the shell, argv[0] becomes the name of the shell script. I don't know how widespread this problem is. On our 4.2 BSD system the code that looks for 'r's in argv[0] is commented out. It got me on a 4.1c BSD system. ========= The opinions expressed above are mine. %% "We must remove the TV-induced stupor that lies like a fog across the land." -- Ted Nelson