[net.unix-wizards] A shell by any other name...

ded@aplvax.UUCP (09/08/84)

Occasionally I like to use the Bourne shell interactively. 
On these occasions I would like the sh to read ".profile"
automatically so my prompt can be set, etc.  The documentation 
implies that "sh -" should do it for me...but it doesn't.
True, I can execute "sh", then ". .profile" once
the "$" prompt appears (and I do), but still, but still...

Is there any way to accomplish the above other than 
by using the Bourne shell as my login shell?

-- 

					Don Davis
					JHU/APL
				...decvax!harpo!seismo!umcp-cs!aplvax!ded
				...rlgvax!cvl!umcp-cs!aplvax!ded

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/09/84)

If the shell thinks it is a "login shell" then it will source .profile
before processing regular commands.  Usually this test is just that
argv[0] begins with a dash `-'.  Try linking sh to -sh, for example,
then invoking -sh.

allyn@sdcsvax.UUCP (Allyn Fratkin) (09/16/84)

In article <754@aplvax.UUCP>, ded@aplvax.UUCP writes:
> Occasionally I like to use the Bourne shell interactively. 
> On these occasions I would like the sh to read ".profile"
> 
> Is there any way to accomplish the above other than 
> by using the Bourne shell as my login shell?

Yes.  Try this program (and call it "sh" if you wish!):

main()
{
	execl("/bin/sh","-sh");
}
-- 
From the virtual mind of Allyn Fratkin           sdcsvax!allyn@Nosc
                         UCSD Pascal Project     {ucbvax, decvax, ihnp4}
                         U.C. San Diego                    !sdcsvax!allyn

"Generally you don't see that kind of behavior in a major appliance."

allyn@sdcsvax.UUCP (Allyn Fratkin) (09/16/84)

In article <754@aplvax.UUCP>, ded@aplvax.UUCP (Don Davis) writes:
> Occasionally I like to use the Bourne shell interactively. 
> On these occasions I would like the sh to read ".profile"
> 
> Is there any way to accomplish the above other than 
> by using the Bourne shell as my login shell?

Yes.  Try this program (and call it "sh" if you wish!):

main()
{
	execl("/bin/sh","-sh",0);
}

-- 
From the virtual mind of Allyn Fratkin           sdcsvax!allyn@Nosc
                         UCSD Pascal Project     {ucbvax, decvax, ihnp4}
                         U.C. San Diego                    !sdcsvax!allyn

"Generally you don't see that kind of behavior in a major appliance."