How do I know if I'm in the /bin/sh environment?

der.hans PLUGd@LuftHans.com
Sat, 19 Aug 2000 22:04:56 -0700 (MST)


Am 19. Aug, 2000 schwäzte Mark Berkwitt so:

> The installation instructions for Corel WordPerfect state:
>     The Runme script must operate in the /bin/sh environment.
> 
> How do I know what environment I'm in?

Jean's post shows you how to start /bin/sh and make sure you're running in
it that way.

Also, know that ksh and bash are sh compatable. In fact, in Linux /bin/sh
is usually a soft link to bash. /bin/sh is one of the files that should be
on *all* *NIX boxen. It's more of a fundamental service than smtp (email
transport) :).

To find out more about your environment try a few things.

A '$ ' at the beginning of a line indicates a (user) shell.

$ ps
  PID TTY          TIME CMD
 3437 pts/1    00:00:00 bash
 8896 pts/1    00:00:00 ps
$ 

The default for ps should just indicate programs being run by your current
shell, including the shell itself. Since you were running ps, you know
bash is your shell. It's sh compatable, so you're good to go

$ grep username /etc/passwd
username:x:500:500:generic user:/home/username:/bin/bash
$ 

Here, look for your login id This tells you your default shell, which is
what you should be running.

$ echo $SHE<tab>
/bin/bash
$ 

Here replace '<tab>' with the tab key and see the shell autocomplete the
variable for you :). If it doesn't, you have another variable that starts
with SHE, but has something other than L as it's 4th letter. The variable
to look at is $SHELL.

Finally, for the long version of the first thing:

$ tty
/dev/pts/3
$ ps aux | grep pts/3
username  3437  0.0  1.1  2148  736 pts/3    S    Aug19   0:00 bash
username  8902  0.0  1.1  2340  708 pts/3    R    04:59   0:00 ps aux
username  8903  0.0  0.8  1364  524 pts/3    S    04:59   0:00 grep pts/3
$

tty tells you what termninal you're on, in this case a pseudo
terminal. You then look at the entire process table and grep for the
terminal you're on.

ciao,

der.hans
-- 
#  der.hans@LuftHans.com   home.pages.de/~lufthans/   www.Opnix.com
#  Help Jerry Lewis stamp out M$...oops that's MDA - der.hans