Difference between "/bin/bash" & "/bin/sh"


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Difference between "/bin/bash" & "/bin/sh"
# 1  
Old 02-28-2011
Question Difference between "/bin/bash" & "/bin/sh"

what if the difference between
Code:
 #!/bin/sh

and

Code:
#!/bin/bash

I wrote a script with the second heading now when i change my heading to the first one ...the script is not executing well....im not getting the required output....any solution to this problem...or do i have to start the code again with #!/bin/sh ?Smilie
# 2  
Old 02-28-2011
If using the first one is a problem, the simple answer is: don't use it.

What OS are you using?

Code:
#!/bin/sh

is usually a link to bash, ksh or something else, like dash, and may, or may not run those shells slightly differently when invoked as sh.

On Solaris, sh means sh - the original Borne Shell. On AIX sh means ksh, and on Linux sh generally means bash (or dash), etc.

Look at both to see what they are.
Code:
ls -l /bin/bash
ls -l /bin/sh

# 3  
Old 02-28-2011
im using...
ubuntu 9.1
# 4  
Old 02-28-2011
So "the difference" would likely be that /bin/sh is actually the dash shell, and /bin/bash is, well, the bash shell.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

If cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print t

there are two directories A and B if cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print them (1 Reply)
Discussion started by: yanglei_fage
1 Replies

5. Shell Programming and Scripting

How to insert "#!/bin/bash" to output file

Hi Guys, I want to put or insert #!/bin/bash to my output file named outputfile.sh. Please need some help. inputfile.txt 1111111111 2222222222 3333333333 script: awk -f script.awk inputfile.txt > outputfile.sh DESIRED OUTPUT: (1 Reply)
Discussion started by: pinpe
1 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

difference between "#! /bin/sh" and "#! /bin/sh"

In shell Programming, we know it should begin with "#! /bin/sh", it means use /bin/sh to interpreter the following command in the shell script. But today I saw "#! /bin/sh -", it saied using "-" follow "#! /bin/sh " can avoid spoofing attack. Anyone could explain that for me? What is... (1 Reply)
Discussion started by: cqlouis
1 Replies

8. Infrastructure Monitoring

HPUX net-SNMP interpreter "/bin/perl" not found

I am trying to install net-snmp on an HPUX box. I am getting the fallowing error message when I try to run the snmpconf file. I installed the fallowing version of net-snmp net-snmp-5.0.10.2-HP-UX_B.11.11_9000_800.tar and my HPUX box is version HP-UX commnms B.11.11 U 9000/800... (2 Replies)
Discussion started by: krisarmstrong
2 Replies

9. UNIX for Dummies Questions & Answers

#!/bin/sh script fails at StringA | tr "[x]" "[y]"

I need to take a string (stringA) check it for spaces and replace any spaces found with an equal (=) sign. This is not working. There are spaces between each component: $StringA | tr "" "" The error returned is: test: Specify a parameter with this command Can you help? (3 Replies)
Discussion started by: by_tg
3 Replies
Login or Register to Ask a Question