The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Linux Shell Question: how to print the shell script name ? meili100 UNIX for Dummies Questions & Answers 3 07-01-2008 10:55 AM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-11-2006 11:27 PM
How to run unix commands in a new shell inside a shell script? hkapil Shell Programming and Scripting 2 01-04-2006 03:56 AM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-22-2005 11:18 PM
simple shell - how to get a parameter typed in a shell script cmitulescu Shell Programming and Scripting 3 12-05-2001 12:04 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-23-2005
Registered User
 

Join Date: Jul 2005
Location: banagalore
Posts: 44
Post which shell?

HP-UX B.11.11 U 9000/800 (tb)

in /etc/passwd :
SHELL=/sbin/sh

in man sh :
Code:
 _________________________________________
 |  To obtain:   |    Use the command:   |
 |_______________|_______________________|
 | POSIX Shell   |  /usr/bin/sh ...      |
 | Korn Shell    |  /usr/bin/ksh ...     |
 | C Shell       |  /usr/bin/csh ...     |
 | Key Shell     |  /usr/bin/keysh       |
 | Bourne Shell  |  /usr/old/bin/sh ...  |
 |_______________|_______________________|
little bit confusing..
i like to know which shell i am using?... ie /sbin/sh is posix shell or bourne shell?..

Last edited by Perderabo; 10-23-2005 at 01:04 PM. Reason: Add code tags and clean up table for readability
Reply With Quote
Forum Sponsor
  #2  
Old 10-23-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,636
/sbin/sh is a statically linked version of the bourne shell. It is the correct shell for the root user, for several reasons, not least of which is that if you accidentally delete something the dynamically linked shells depends on your root shell still works and you stand a reasonably good chance of being able to fix it. It is also used during boot, before /usr is mounted and as such it is the only working shell at that point.

Some people do change the root login shell, personally I think that doing so is at best foolish. It takes less than a second to type the command for a preferred shell such as ksh tcsh or bash.

Last edited by reborg; 10-23-2005 at 02:51 PM. Reason: spelling
Reply With Quote
  #3  
Old 10-23-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,654
Quote:
Originally Posted by reborg
/sbin/sh is a stically linked version of the bourne shell.
Not on HP-UX...
Code:
$ uname -srm
HP-UX B.11.11 9000/800
$ file /usr/bin/sh /sbin/sh
/usr/bin/sh:    PA-RISC1.1 shared executable dynamically linked
/sbin/sh:       PA-RISC1.1 shared executable
$ exec /sbin/sh
$ [[ +123 = ?(+|-)+([0-9]) ]] && echo +123 is an integer
+123 is an integer
$
On HP-UX, the Bourne shell has been retired and is only available in /usr/old/bin/sh. All other shells named sh are Posix shells. The HP-UX Posix shell is basicly ksh88 with a few tweaks for strict Posix compatibility. So /sbin/sh is a staticly linked Posix shell.
Reply With Quote
  #4  
Old 10-23-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,636
Oops my bad, I missed the very first line and am so used to dealing with Solaris that I responded on autopilot.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0