sh[it] and What am I missing here?

Baho Utot baho-utot at columbus.rr.com
Sun Jun 5 16:46:48 UTC 2016


On 06/05/16 12:36, David Christensen wrote:
> On 06/05/2016 09:30 AM, Baho Utot wrote:
>> No I don't want to have sh as my shell or change the default shell.
>> I am just writing a script to build packages from ports on a new 
>> install.
>> As bash is not available but sh was I'll use that to script into.
>>
>> Now when I was writing the script syntax that should have been a Ok in
>> sh it was/is failing.
>> After some head scratching I found that maybe I wasn't really using or
>> in a bourne shell ie /bin/sh.
>> That made me think that even though I have #!/bin/sh at the top of the
>> script some how I wasn't really getting sh but csh.
>>
>> So here is what I tried.
>> Power on console ( boot computer )
>> Login in as root
>> /bin/sh
>>
>> set    #  to show environment etc
>> WTF SHELL says I am in csh????
>>
>> It should say SHELL=/bin/sh
>>
>> Hence my question here as to what is going on.
>
> Is your script executable?
>
>     # chmod +x scriptname

Yes

>
>
> Does it have a shebang line?
>
>     #!/bin/sh
>
>

Yes

> Does it make use of the SHELL variable?
>
>

No

It also behaves as if it is in tcsh/csh from the command prompt.... Ok 
you can try this from home ; )

login in as a user ( non root )
set
SHELL is set to SHELL=/bin/sh
Ok now try
su - (give password)
set
SHELL=/bin/csh Ok that makes sense
Now
/bin/sh
set
SHELL=/bin/csh WTF?

Log out of all the

login as root
set
SHELL=/bin/csh Ok that makes sense
/bin/sh
set
SHELL=/bin/csh WTF?

It looks to me ( if I am not missing something here )
That I can only get to sh by loging in as a user...Again WTF




More information about the freebsd-questions mailing list