galew_a@peyote.cactus.org (Andy Galewsky) (02/10/90)
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. I have tried putting #!/bin/sh as the first line of the shell script - but BASH continues to try to execute it - itself. It doesn't seem right that I have to throw away all of my old shell scripts in order to run BASH. This is probably not a BASH bug - but just a problem with my understanding of how this works. Thanks Andy Galewsky Clinical Resource Systems peyote!sneffels!andy galew_a@peyote.cactus.org
bfox@sbphy.mit.edu (Brian Fox) (02/21/90)
Date: 9 Feb 90 23:53:27 GMT From: milano!peyote!galew_a@cs.utexas.edu (Andy Galewsky) Organization: Capital Area Central Texas Unix Society, Austin, TX Sender: bug-bash-request@prep.ai.mit.edu 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. I have tried putting #!/bin/sh as the first line of the shell script - but BASH continues to try to execute it - itself. It doesn't seem right that I have to throw away all of my old shell scripts in order to run BASH. This is probably not a BASH bug - but just a problem with my understanding of how this works. Thanks Andy Galewsky Clinical Resource Systems peyote!sneffels!andy galew_a@peyote.cactus.org System V machines don't pay attention to #! in the first line. Their fault, not yours. If the system call exec () didn't exec the file, then bash assumes that the file is a bash script. Not a bad assumption, and in fact, the same assumption that /bin/sh makes. Brian
trost@reed.bitnet (Bill Trost,Box 607,ext 640,) (02/24/90)
>If the system call exec () didn't exec the file, then >bash assumes that the file is a bash script. Not a bad assumption, and >in fact, the same assumption that /bin/sh makes. What, the Bourne shell assumes files are bash scripts when exec() fails? Nahhhh... :-) :-) :-) :-) :-) :-) :-) :-) Just filling up the net....
Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) (02/27/90)
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