[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash profile how?



Michael B Allen wrote:
> Bob Proulx said:
> > I think you have hit the nail squarely on the head.  How do you make
> > it work for all possible shells?  I believe that to be the crux of the
> > issue.  Anything that is done is wrong for one shell or another.

Note I was talking about setting up a /etc/skel/ file for ~/.xsession
with #!/bin/bash already included.  Or rather why that would not work.

> Well the exec -l $SHELL -c "$STARTUP" solution fixes that

Agreed.

> provided /bin/sh exec accepts the option like bash.

That was the problem with /bin/sh.  /bin/sh is not required to accept
args like /bin/bash.  In which case the script interpreter must simply
be #!/bin/bash.  Using 'exec -l' plus using #!/bin/bash works.  At
least I can't refute it after thinking about it for the day.

> To make it work with other shells would not be hard as the -l option
> to exec just sets the zero'th argument of the command to '-' which
> appears to be a convention shared with ash at least.
> From the ash man page:
> 
>   If the first character of argument zero to  the  shell  is
>   ``-'',  the  shell is assumed to be a login shell, and the
>   files /etc/profile and .profile are read  if  they  exist.

I think you missed the point I was making.  I was not arguing that
shells would ignore the leading '-' and not be invoked as a login
shell.  I was arguing that 'exec -l' required #!/bin/bash and would
not work reliably with #!/bin/sh because /bin/sh might not be bash.

Bob

Attachment: pgpt6L3rS2Stc.pgp
Description: PGP signature


Reply to: