|
From: | David Boyce |
Subject: | Re: Odd effects from setting SHELL? |
Date: | Fri, 22 Jun 2007 14:33:37 -0400 |
At 10:23 AM 6/22/2007, Christian Convey wrote:
Good catch - you were right. Suppose I switch to SHELL=/bin/sh. Is there some accepted way to prevent *other* people using my makefiles from having the same problem I experienced? For example, Joe Programmer checks out my whole project, and Joe's ~/.bashrc file has a "cd" or "cd ~" line, just like I had/have in my ~/.cshrc file. Is there a convention to help him avoid the trap I fell into? Or is it just not a problem with bourne-compatible shells? : If bash is invoked as "sh", it automatically applies its "--norc" feature to avoid reading configuration files. I know Ubuntu has /bin/sh --> dash, and I *think* from dash's man pages that the only time it ever reads a configuration file at all is, if you're using it as a login shell, it reads ~/.profile. So 'dash' might be safe from this "cd" or "cd ~" problem as well. So maybe bourne-based shells just don't have this as an issue at all?
Yes, that's right. The issue is specific to csh-style shells and is a design flaw. Bourne shells have no such problem which is why setting SHELL to anything but /bin/sh is so stringly deprecated.
Didn't know about the reasons for preferring /bin/sh. The guy who originally wrote the makefiles wasn't setting SHELL at all, and his default shell is tcsh. When I tried to build (my default is bash), the code wouldn't run.
I think you may still be a little confused on this point. No make program, including GNU make, EVER pays attention to the user's default shell. If you don't override it explicitly on the command line or within the makefile, it will use the system shell, period.
-David Boyce
[Prev in Thread] | Current Thread | [Next in Thread] |