Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-08-2002, 12:30 AM   #1
DJSdotcom
Prospect
 
Join Date: Apr 2002
Location: Rochester, NY
Posts: 1
Unhappy No /bin/bash in OS X

Well I've been trying to write some shell scripts using the standard:
#!/bin/bash
syntax at the beginning, and just figured out why it doesn't work. No matter WHAT you select in the Terminal preferences pane, or what you write down to use, you will never be able to use bash in OS X unless you download and make it yourself. Check it out for yourself, when it says what shell to use in the prefs, click on "your own shell", type in /bin/bash, and boom you're done... so you think. The next time a shell window opens up, the title may say /bin/bash, but if you ps -x, the last process will still say -tcsh!
DJSdotcom is offline   Reply With Quote
Old 04-08-2002, 01:00 AM   #2
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
you can't order pizza if it isn't on the menu.

yeah, OSX don't come with bash, but your scripts should mostly work if your she-bang is changed to

#!/bin/sh

scripts shouldn't generally be written for bash and tcsh shells, as that makes them un-portable. #!/bin/bash is no standard.

you could also specify /foo/bar as the shell in terminal; it doesn't check.

bash and tcsh shells have a lot of features that are interactive, and don't translate to scripts.

you should generally write shell scripts in sh, which is most likely supported on every unix boxen you could find.

and it's relatively simple to implement bash in OSX...

finkify: http://fink.sourceforge.net/
mervTormel is offline   Reply With Quote
Old 04-08-2002, 04:13 AM   #3
honestpuck
Major Leaguer
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 256
Re: No /bin/bash in OS X

Quote:
Originally posted by DJSdotcom
Well I've been trying to write some shell scripts using the standard:
#!/bin/bash
syntax at the beginning, and just figured out why it doesn't work. No matter WHAT you select in the Terminal preferences pane, or what you write down to use, you will never be able to use bash in OS X unless you download and make it yourself.

Well you don't have to download and make it yourself. Install fink (sourceforge.net/projects/fink/ ) and it will allow you to easily download and install 'bash' amongst a large number of other fine *nix open source tools. Highly recommended!

Tony

P.S. Most Unix programmers many years ago decided that '#!/bin/sh' was the correct thing to put.
honestpuck is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.