1832305 Members
1970 Online
110041 Solutions
New Discussion

Editor and shell

 
Mridul Dutta
Advisor

Editor and shell

Hi friend ..


I have some queries regarding Unix OS.

1) what editor do one use?

2) what shell do one use?

3) what is the best shell for root and why?

Regards

Mridul
3)
7 REPLIES 7
Arunvijai_4
Honored Contributor

Re: Editor and shell

Hi Mridul,

Q 1) what editor do one use?

My vote is for "vi" though some people prefer to use "emacs". "vi" is simple and easy to use than "emacs" (** Its my opinion**)

Q 2) What shell do one use ?

Borne shell by default (sh) or Korne shell (ksh)

Q 3) what is the best shell for root and why?

Borne shell is the best shell for root since you can use it in single user mode. It is compiled & linked statically.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Editor and shell

In hpux,

1)

We can change the editor with EDITOR environment variable.

echo $EDITOR shows your editor type.

EDITOR If the value of this variable ends in emacs,
gmacs, or vi and the VISUAL variable is not set,
the corresponding option is turned on.

2)

By default, It is /bin/sh or /bin/ksh for hp-ux.

You can view the shell type as,

echo $SHELL

3) Best shell is different usage purpose. Advanced one is BASH and KSH is ok.

To change EDITOR and SHELL type you have to change /etc/profile or $HOME/.profile for permanent action.

-Muthu


Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Editor and shell

System 5 standard defines vi as the default editor for any UNIX os. Solaris uses C shell as default sometimes.

BASH is the most advanced Shell as well as TCSH.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Devender Khatana
Honored Contributor

Re: Editor and shell

Hi,

1) vi is the best and most powerful editor for unix. The best thing about it is same functionality across all platforms.

2) The default shell is different for various flavours of unix. For HPUx it is Posix, for Linux it is bash and so on.

3) In my opinion the default OS shell should be used for root unless otherwise required as it provides you all functionalities required by root and if specific application requires other shell these should be run through particular applications. One major reason for this will be that when you are in sinngle user mode for system maintenance and only root is mounted, the access to other shells will probably not be available.

HTH,
Devender
Impossible itself mentions "I m possible"
Arunvijai_4
Honored Contributor

Re: Editor and shell

Here is shell comparison document,

http://64.233.161.104/search?q=cache:IbSsx-c9Z6EJ:docs.rinet.ru:8080/UNIXs/ch13.htm+unix+shell+comparison&hl=en&client=firefox-a

(Original site is down, so this is from Google's cache)

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
James R. Ferguson
Acclaimed Contributor

Re: Editor and shell

Hi Mridul:

1. I use 'vi' for its general applicability to any UNIX environment. You can always find it available.

2. The POSIX shell is the default HP-UX shell. It is considered a superset of the 'ksh' shell.

3. NEVER, NEVER, EVER, use anything but '/sbin/sh' for the root account as defined in '/etc/passwd'. The standard shell for HP-UX users is '/usr/bin/sh', whereas the REQUIRED shell for root is /sbin/sh'.

THe difference is that '/usr/bin/sh' has been compiled with dynamically linked libraries whereas '/sbin/sh' uses only static ones.

NEVER change root's shell. The '/usr' filesystem isn't mounted during the early stages of system startup and any shell that needs needs the dynamically libraries therein would not be able to link to them. If you did this for the root user, you would find that your system was unbootable.

Use the '/usr/bin/sh' for all other non-root users. Using the dynamically linked, shared libraries provides a better memory footprint than having the static structure of '/sbin/sh'.

Both '/sbin/sh' and '/usr/bin/sh' are POSIX shells. The old Bourne shell lives as '/usr/old/bin/sh'. You also have '/usr/bin/ksh' which is Korn88 and '/usr/dt/bin/dtksh' which is Korn93. A '/usr/bin/csh' shell is also available.

A very good site for shell scripts and tips is:

http://www.shelldorado.com/

A guide to shells can be found here:

http://docs.hp.com/en/B2355-90046/index.html

As far as the 'csh' shell is concerned, I'd avoid it. The 'csh' shell is far inferior to the Posix ('usr/bin/sh'), 'ksh', and 'bash' shells.

See here, for one discussion of why *not* to use 'csh':

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

All shell scripts start with a declaration of the shell interpreter, clearly identifing the shell in use, like this:

#!/usr/bin/sh
#!/usr/bin/ksh
#!/usr/dt/bin/dtksh

Regards!

...JRF...
Raj D.
Honored Contributor

Re: Editor and shell

Hi Mridul,

In short here is the answer,


1) what editor do one use?
A: vi

2) what shell do one use?
A: korn shell , or bourne shell
/usr/bin/ksh or /usr/bin/sh

3) what is the best shell for root and why?
hp-ux POSIX sheel provides many advantage and it can be used widely . /usr/bin/sh



hp-ux supports the following shells:
------------------------------------

The HP-UX operating system supports the following shells:

sh POSIX-conforming command programming language and
command interpreter residing in file /usr/bin/sh. Can
execute commands read from a terminal or a file. This
shell conforms to current POSIX standards in effect at
the time the HP-UX system release was introduced, and
is similar to the Korn shell in many respects. Similar
in many respects to the Korn shell, the POSIX shell

contains a history mechanism, supports job control, and
provides various other useful features.

sh Bourne-shell command programming language and commands
interpreter residing in file /usr/old/bin/sh. Can
execute commands read from a terminal or a file. This
shell lacks many features contained in the POSIX and
Korn shells. The Bourne shell will be obsoleted.
Users are strongly encouraged to switch to the POSIX
shell. The Bourne shell will still be available as
/usr/old/bin/sh, for those users have to use it.

ksh Korn-shell command programming language and commands
interpreter residing in file /usr/bin/ksh. Can execute
commands read from a terminal or a file. This shell,
like the POSIX shell, contains a history mechanism,
supports job control, and provides various other useful
features.

csh A command language interpreter that incorporates a
command history buffer, C-language-like syntax, and job
control facilities.

rsh Restricted version of the POSIX or Bourne shell command
interpreter. Sets up a login name and execution
environment whose capabilities are more controlled
(restricted) than normal user shells.

rksh restricted version of the Korn-shell command
interpreter Sets up a login name and execution
environment whose capabilities are more controlled
(restricted) than normal user shells.

keysh An extension of the standard Korn Shell that uses
hierarchical softkey menus and context-sensitive help.

-----------------------------------------

Further # man sh

cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "