1752294 Members
4775 Online
108786 Solutions
New Discussion юеВ

shell

 
Yarok
Regular Advisor

shell

Hello,

1. How can I know what is the default shell I am working with?
2. How can I config/determine the requested shell?
3. Where can I see each shell fetures (win size, ^d, ^z on so on)?

Thanks,

Yaron
6 REPLIES 6

Re: shell

Yaron,

1. You get the shell that is set for any given user in /etc/passwd - you can get see what this is using:

grep ^$(whoami): /etc/passwd | cut -d: -f 7

2. You can change your default shell using the chsh command. You can only set your shell to those listed in the /etc/shells file (if one exists on your system)

3. Read the man page for the shell:

man sh-posix
man ksh
man csh

etc...

WARNING: Do not chnage the default shell for the root user from /sbin/sh - you will break your system...

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Jose Mosquera
Honored Contributor

Re: shell

Hi,

General environment definitions could be useful:
#env
#man env
And the current settings of terminal also:
#stty -a
#man stty

Rgds.
Vidhya B
Frequent Advisor

Re: shell

Hi,

1. How can I know what is the default shell I am working with?

You can use #echo $SHELL
This gives the default working shell. To see the individual user's shell, you can see it in /etc/passwd as said above.


2. How can I config/determine the requested shell?

USe either usermod -s or chsh


3. Where can I see each shell fetures (win size, ^d, ^z on so on)?

I can think of anything other than the man pages.
James R. Ferguson
Acclaimed Contributor

Re: shell

Hi Yaron:

If you are new to the shell, at least avoid the 'csh' (C-shell) for serious scripting. This classic FAQ discusses why:

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

The HP-UX default shell is the POSIX one found as '/usr/bin/sh' for normal users and as a statically linked version for root as '/sbin/sh'.

Regards!

...JRF...
Yarok
Regular Advisor

Re: shell

Thanks for the info.

as you all noted, sh /sbin/sh is the default shell.
When I open a terminal and type:
#tcsh (to get a better env) still the
#echo $SHELL command gives me /sbin/sh. Why?
Can I determine that tcsh for instance, will be my defualt shell? how?

Thanks,

Yaron

Re: shell

You have already been warned against changing the default shell for root (which in your last post the default shell being /sbin/sh and the prompt of "#" seem to indicate you are working as).

You've also been warned aginst using the C shell which tcsh is a variant of.

As for wht "echo $SHELL" still returns /sbin/sh, this is because the environment variable SHELL is set by login(1) and is then inherited by any command spawned by that process. Unless it explicitly set to something else by the spawned process it will stay as it was. If your login shell were set to tcsh in /etc/passwd then this would show up in the SHELL environment variable - but as indicated above you _should not_ do that for root.

HTH

Duncan

I am an HPE Employee
Accept or Kudo