On Jan 31, 2008, at 3:36 AM, Ryan Schmidt wrote:
On Jan 31, 2008, at 00:36, jmpp@macports.org wrote:
Revision: 33591 http://trac.macosforge.org/projects/macports/changeset/33591 Author: jmpp@macports.org Date: 2008-01-30 22:36:50 -0800 (Wed, 30 Jan 2008)
Log Message: -----------
Seems like the source of all my pains is Installer.app, which aparently limits the environment I run under in some way and forces SHELL to /bin/sh always (even if I run as a login shell, it just doesn't seem to be possible to get to the user's info), rendering useless the `case` routine that tries to determine the shell I need to tweak.
As a lame workaround, I'm going to glob for *sh to match /bin/sh and thus still write my settings to the common profile file, leaving all those *csh users out there a bit in dispair.
Could you read the user's real shell like this?
USHELL="$(nicl . -read /users/rschmidt shell | sed 's/^shell: //'')"
Very nice suggestion Ryan, thanks! I'd been making assumptions about the environment under which a shell script runs, and not only do I think I was mistaken in the general case, but also Installer.app seems to make the situation even worse by apparently enforcing a very specific environment (understandable from the security concerned point of view), but then again it could have been just my tired eyes last night reading that from /var/log/install.log In any case, your suggestion seems straight forward and simple enough, so I'll quit trying to reinvent the wheel and will give it a shot as soon as I get a few spare minutes (there are some implementation details, like nicl for < 10.4 and dscl for Leopard, among others). Regards,... -jmpp