bash question

Jerry Feldman gaf-mNDKBlG2WHs at public.gmane.org
Sun Jan 4 11:20:52 EST 2009


On 01/04/2009 08:54 AM, Ben Eisenbraun wrote:
> On Sat, Jan 03, 2009 at 06:11:13PM -0500, dan moylan wrote:
>  =20
>> only the GUI.
>>    =20
>
>  $ head -n 1 /etc/gdm/Xsession && grep '\.profile' /etc/gdm/Xsession=20
> #!/bin/sh
> # First read /etc/profile and .profile
> test -f "$HOME/.profile" && . "$HOME/.profile"
>
> You could rename your .profile to .bash_profile.  I didn't test it, but=
 I
> suspect that would solve your problem with X logins.
>  =20
Thanks for posting this Ben. I don't have my ubuntu laptop with me, but=20
that would certainly explain why Dan is getting the error is that the=20
Xsession script is a Bourne Shell script not a bash script:
#!/bin/sh

Additionally, I checked on Fedora 10, and Fedora 10 /etc/gdm/Xsession is =

actually a bash script.

Note that on Linux when /bin/sh is symlinked to bash or dash, the shell=20
looks at how it was invoked, and probably has a switch to enable or=20
disable some features. The same way that egrep(1) and fgrep(1) are=20
symlinked to grep. egrep(1) behaves as if the -E option were set. The=20
vi(1) command also behaves that way. This is one of the very nice=20
features of Unix=AE and Linux in that the first argument to any program=20
(and script) contains the command it was executed under, the programmer=20
uses basename(3) to remove the leading path. So regardless of how=20
/bin/sh is symlinked, any script with "#!/bin/sh " as the first line=20
should be parsed as a POSIX shell.

--=20
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846







More information about the Discuss mailing list