- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripts running as /bin/sh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:34 AM
06-04-2002 06:34 AM
We have several scripts and codes running on 11.0. The developers somehow prefer /bin/sh to run their programs from. I welcome all the gurus to comment on this practise.
Thanks
Brian.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:38 AM
06-04-2002 06:38 AM
Re: scripts running as /bin/sh
/usr/bin/sh (bourne shell) is the most basic shell that comes with all OSes. Thus, using this shell makes it portable across UNIX platforms.
If say you use /usr/bin/ksh and you want to port the script to Solaris, the additional effort to install the korn shell is needed.
Also, because it has less fanciful stuff, I believe the binary is smaller and more efficient.
Portability and less resource intensive.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:41 AM
06-04-2002 06:41 AM
Re: scripts running as /bin/sh
Remember some things :
for ROOT always use /sbin/sh
You can /bin/sh for the users- there are no issues. You can also use /usr/bin/ksh ( Korn shell ) and /usr/bin/sh ( Bourne shell )for the users which givves you other advantages also.
Piyush
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:41 AM
06-04-2002 06:41 AM
Re: scripts running as /bin/sh
You may like at the following :
http://www.uswebsites.com/support/cgi_scripts.shtml
http://google.yahoo.com/bin/query?p=developers+prefer+%2fbin%2fsh&hc=0&hs=0
It is more of a legacy , than any thing else .
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:47 AM
06-04-2002 06:47 AM
Re: scripts running as /bin/sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:48 AM
06-04-2002 06:48 AM
Re: scripts running as /bin/sh
On HPUX, the /bin/sh is a hard linked to /usr/bin/sh. It's the POSIX shell, I believe it's the default shell. In may areas, it is similar to the Korn shell. e.g. it has shell history, support job control and other stuffs.
If you need a comparision of various shells on HP, try the "man sh".
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:51 AM
06-04-2002 06:51 AM
Re: scripts running as /bin/sh
/usr/bin/sh on HP-UX is the POSIX shell which is allmost the same than Korn shell.
/usr/bin/ksh is the Korn shell, very similar to POSIX shell
/sbin/sh is the superuser shell, should be the shell for root on every computer!
/usr/bin/csh the c- shell, which uses a different syntax, near to the programming language C.
/usr/old/bin/sh on HP-UX the Bourne shell, which is very old and not comfortable at all, no history, no file name generation and so on....
To get scripts, which run not platform dependant, you could use /usr/bin/ksh, which is available on allmost every platform. Remember, not every shell has the same syntax, but POSIX and Korn shell have.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:52 AM
06-04-2002 06:52 AM
Re: scripts running as /bin/sh
Oops, I have made a mistake. As indicated by the rest, it is the POSIX shell, not the Bourne shell.
I personally still prefer /usr/bin/sh because it is available on default across Unixes and Linuxes. Makes it easier for me to port it across platforms. If I use bash (bourne-again shell, should be right this time ;) ), then I have to specifically install it on the other Unix platform that does not support it by default.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:54 AM
06-04-2002 06:54 AM
Re: scripts running as /bin/sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 06:56 AM
06-04-2002 06:56 AM
Re: scripts running as /bin/sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 07:05 AM
06-04-2002 07:05 AM
Re: scripts running as /bin/sh
systemname>ll -d /bin /usr/bin /sbin
lr-xr-xr-t 1 root sys 8 Mar 6 08:52 /bin -> /usr/bin
dr-xr-xr-x 12 bin bin 3072 Apr 29 05:08 /sbin
dr-xr-xr-x 6 bin bin 10240 Jun 3 05:11 /usr/bin
systemname>ll -d /bin/sh /usr/bin/sh /sbin/sh
-r-xr-xr-x 2 bin bin 221184 Apr 23 2001 /bin/sh
-r-xr-xr-x 1 bin bin 421888 Apr 23 2001 /sbin/sh
-r-xr-xr-x 2 bin bin 221184 Apr 23 2001 /usr/bin/sh
/bin is a transition link to /usr/bin. It could be removed in any version. /bin/sh /usr/bin/sh is the same.
see man tlinstall tlremove.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 10:55 AM
06-04-2002 10:55 AM
SolutionThere is good and bad news with that: the good news is that old scripts will still run as usual (assuming they have the #/bin/sh header), and there are many flavors of Unix that still don't conform so the scripts will still work.
The bad news is that /bin/sh 'looks' like the Bourne shell and this scares users into using good old ksh. Also, changing the shebang (the #!/ header that specifies which interpreter to use) to #!/usr/bin/sh may break the script on other platforms. And transition links are optional--which means that a new administrator may look at the industry standards and decide to remove the transition links, thus breaking many scripts.
The future of transition links is not guarenteed! A new version of HP-UX may default to no links by default, and further revisions may not provide them.
One note about POSIX shells: HP-UX POSIX shell (which is stored in two formats in /usr/bin and /sbin) is one of many 'POSIX' shells. The Korn shell (as well as bash) are POSIX compliant which is why the vast majority of ksh and bash scripts run just fine using /usr/bin/sh. There is a great list that defines the differences (not many and pretty esoteric) in the 10.xx Release Notes in /usr/share/doc. For instance, ulimit has full functionality in the HP POSIX shell and bash (type ulimit -a) but ksh does not.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 12:12 PM
06-04-2002 12:12 PM
Re: scripts running as /bin/sh
Indeed, all are POSIX shells.
One thing to add, maybe. The 'superuser shell', /sbin/sh, is a statically linked POSIX shell. This is required for running a shell in single user mode (i.e. when /usr is not mounted and the shared libraries are not accessible).
Rik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 12:31 PM
06-04-2002 12:31 PM
Re: scripts running as /bin/sh
/bin/sh is never the right path. It should be /usr/sbin/sh and the same applies to /lib also. Take a case where an administrator may run "tlremove" and all the /bin codes would break. As Bill pointed out it is a mere symbolic link for old codes.
Giri Sekar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2002 12:36 PM
06-04-2002 12:36 PM
Re: scripts running as /bin/sh
Thanks for your time. It was a great learning experience. I never knew a command called "tlremove" before. I will make sure the guys here stick to /usr/bin/sh.
Thanks again
Brian