Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the difference between #!/bin/bash and #!/bin/sh 1

Status
Not open for further replies.

mtorbin

Technical User
Joined
Nov 5, 2002
Messages
369
Location
US
This is in reference to cron jobs. I'm going to attempt to write my own cron into cron.monthly and some files use the /bash and others use /sh. Which one do I need and where? What is the difference?

Thanks,

- MT
 
sh is a symbolic link to bash, but bash behaves differently if you call it sh. I think you should just use bash, since it's guaranteed to be on you system and you don't have to worry about portability.
 
There are many "shells"
e.g. bourne-, bash-, korn-, z-shell

Each observes differing syntax, constructs, and behaviors

D.E.R. Management - IT Project Management Consulting
 
/bin/sh scripts written under linux tend not to work real well on sun/solaris boxen...
 
Which is why I always write my portable scripts in ksh. :-)
 
I like zsh too, used that a lot on free-bsd and tru/64 boxes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top