What is this shell called ?


 
Thread Tools Search this Thread
Operating Systems HP-UX What is this shell called ?
# 1  
Old 07-08-2011
Question What is this shell called ?

SmilieWhat is this shell called ?

"/sbin/sh"

When I run "echo $SHELL" command on my HP-UX,I get above output.

In Linux It was "/bin/bash". Which is bash shell.
# 2  
Old 07-08-2011
BASH and sh are both Bourne shells. BASH has extended features, like arrays and regular expressions, that /sbin/sh or /bin/sh can't be depended on to have. On Linux, /bin/sh is just a symlink to BASH, so it will, but will break if you move the script somewhere else.

If you use BASH features you should always give it #!/bin/bash

/bin/ksh, the Korn shell, is another extended Bourne shell that's more popular in the UNIX world rather than the Linux one, it also has arrays and a few other goodies (floating point numbers!) but its arrays don't work the same way as BASH's.
# 3  
Old 07-08-2011
Quote:
On Linux, /bin/sh is just a symlink to BASH,
On Ubuntu and its derivatives /bin./sh is the DASH shell. DASH= Debian Almquist.
# 4  
Old 07-09-2011
I have no knowledge also with that, I am glad you ask and got some answer from them. It's kinda benificial to have found this thread. Thank you.
# 5  
Old 07-11-2011
/sbin/sh in HP-UX is the true bourne shell, it is different of /usr/bin/sh (Posix compliant shell) in the way it works and is normally used only by root, therefore it is not a good idea to change root's default shell by anything else (you can always call your preferred shell later...). I have seen engineers doomed after changing their root shell in /etc/passwd after having (not so) serious issues with servers not rebooting properly and so in single user (ah bad luck, /usr isnt mounted...). see:
Code:
ant:/home/vbe $ file /sbin/sh
/sbin/sh:       PA-RISC1.1 shared executable
ant:/home/vbe $ file /usr/bin/sh
/usr/bin/sh:    PA-RISC1.1 shared executable dynamically linked

# 6  
Old 07-11-2011
Sorry vbe but this is wrong for HP-UX.
/sbin/sh is the Posix Shell not the old Bourne Shell. It's a version without dynamic libraries which will run standalone. System scripts will run with /sbin/sh or /bin/sh or /usr/bin/sh . The /sbin/sh version is faster but uses more memory per instance.


Try this modern Posix syntax:
Code:
a=1
b=2
c=$((a + b))
echo $c


See HP-UX "man sh" for an explanation of the various Shells. Just for interest, /usr/old/bin/sh is the old Bourne Shell.

Forgot to mention: The bash Shell is not supplied as standard with HP-UX.

Last edited by methyl; 07-11-2011 at 08:32 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Interpreting Shell Script errors when called from CRON

Hi All, I am calling a series of shell scripts via CRON so everything is running as root. However, in my error log file I am seeing the following errors. Please can anyone offer any advise as to the possible causes and solution to prevent the errors from appearing. The Error 1227 seems to... (2 Replies)
Discussion started by: daveu7
2 Replies

2. UNIX for Dummies Questions & Answers

shell program- how many times a function is called

We have a program source C and is required to indicate how many times each function is called from the C program. also print the line number where there is a call. I've tried something like this: #!/bin/sh for i in $*;do if ! then echo $i is not a C file. else echo $i... (0 Replies)
Discussion started by: oana06
0 Replies

3. Shell Programming and Scripting

Can a shell variable be called in a cobol program

Hi All, I have a file which sets all the variables on unix , based on the hostname. Currently these variables are hardcoded in the cobol programs.I was wondering if unix variables can be used in Cobol programs ? Example : I have a variable $SHTEMP which is set based on the following : Prod... (2 Replies)
Discussion started by: nua7
2 Replies

4. UNIX for Advanced & Expert Users

Why only partiial shell script got executed when called in Java

I'm trying to call shell scripts from Java for DB operations. Using a very simple test, for some reason, one line of (ALTER TABLE) in the shell simply won't be executed while the exit value from the call is "0" (valid exit). When I run the script directly in Unix, it gets executed perfectly fine!!... (4 Replies)
Discussion started by: zmwang
4 Replies

5. UNIX for Dummies Questions & Answers

How to retrieve the value of variable in shell script which is called by crontab

There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg) configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The... (4 Replies)
Discussion started by: jadoo_c2
4 Replies

6. Shell Programming and Scripting

environment variable in shell script called through crontab

Please help me on below.. https://www.unix.com/shell-programming-scripting/141533-retrieve-value-environment-variable-shell-script-called-crontab.html#post302442024 I'm still here. I can still see you! (0 Replies)
Discussion started by: jadoo_c2
0 Replies

7. Shell Programming and Scripting

Retrieve the value of environment variable in shell script which called from crontab

There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg) configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The... (0 Replies)
Discussion started by: jadoo_c2
0 Replies

8. Shell Programming and Scripting

cpio in shell called from php

I have a php program that calls a shell script, this part works fine and most of the commands work. However, I have a cpio command in the shell script, and for some reason this doesn't work. If I catch the return code, it's 1 which means it terminated with an error, but I get no other indication of... (3 Replies)
Discussion started by: mmarino
3 Replies

9. Shell Programming and Scripting

gzip in shell script called by cron

I'm puzzled by this one. I hope you can explain it to me. I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies
Login or Register to Ask a Question