Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!kaukau.comp.vuw.ac.nz!ajv From: Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) Newsgroups: gnu.bash.bug Subject: Re: BASH and Bourne Shell scripts Message-ID: <1990Feb27.085948.21069@kaukau.comp.vuw.ac.nz> Date: 27 Feb 90 08:59:48 GMT References: <376@peyote.cactus.org> <9002210515.AA12755@sbphy.Ucsb.EDU> Sender: news@kaukau.comp.vuw.ac.nz (News Admin) Reply-To: ajv@comp.vuw.ac.nz (Andrew Vignaux) Distribution: gnu Organization: Comp Sci, Victoria University, Wellington, New Zealand. Lines: 52 In article <9002210515.AA12755@sbphy.Ucsb.EDU>, bfox@sbphy.mit.edu (Brian Fox) writes: > > From: milano!peyote!galew_a@cs.utexas.edu (Andy Galewsky) > > I hope I'm not just being stupid (it has happened before) but - when I am > running BASH-1.04 and I try to execute a Bourne shell script - I can't get > /bin/sh to execute it -- BASH tries to do it. > [...] > > System V machines don't pay attention to #! in the first line. Their > fault, not yours. I hope I wont be classed as a heritic, but after half an hour of a) loving bash 1.04, but b) working on a system which doesn't accept #!, and c) having bash run scripts itself, but d) the bash echo and the system's echo having different sematics I added the following patch. Not very nice, or pretty and certainly NOT OFFICIAL!! I define XSHELL=/bin/sh in my .bashrc and all the system scripts work like they used to :-) A slightly more substantial patch would probably try to do the #! stuff itself if XSHELL was defined. *** execute_cmd.c.orig Fri Nov 3 21:11:24 1989 --- execute_cmd.c Tue Feb 20 13:20:19 1990 *************** *** 902,907 **** --- 902,916 ---- if (args[0][0] == '-') args[0]++; + { + char * last_chance_shell = get_string_value ("XSHELL"); + if (last_chance_shell) { + execve (last_chance_shell, args, export_env); + report_error ("%s: Cannot execute %s", shell_name, last_chance_shell); + exit (EXECUTION_FAILURE); + } + } + exit (main (larry, args, export_env)); } } Andrew -- Domain address: Andrew.Vignaux@comp.vuw.ac.nz