Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Apple Switches to Bash

Apple Switches to Bash
Thread Tools
Senior User
Join Date: Feb 2003
Location: Atlanta
Status: Offline
Reply With Quote
Aug 25, 2003, 11:17 AM
 
It appears that in the latest Panther seed apple has switched to the Bash shell. I have not used Linux extensively so I am unfamiliar with the specific differences. Would someone care to comment on the pros/cons of Bash over Tcsh?
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Aug 25, 2003, 11:26 AM
 
regardless of whether they have, or have not, i'd like to know too. if someone could give us the lowdown, that would be great.
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Moderator
Join Date: Apr 2001
Location: Las Vegas, NV
Status: Offline
Reply With Quote
Aug 25, 2003, 12:04 PM
 
'bout time.

Read this article on the differences between the shells.

"And after we are through, ten years in making it to be the most of glorious debuts."
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 25, 2003, 12:12 PM
 
Originally posted by coolmacdude:
It appears that in the latest Panther seed apple has switched to the Bash shell. I have not used Linux extensively so I am unfamiliar with the specific differences. Would someone care to comment on the pros/cons of Bash over Tcsh?
Tcsh is not really even in the running for "best shell". Some people will argue for zsh or ksh or whatever, but most would agree that bash (or zsh) is an improvement over tcsh.

Tcsh is an extended version is csh (C-Shell). C-Shell was designed to have its syntax follow the pattern of the C programming language. While this has some interesting ideas, it ends up being VERY bad as a shell programming language. Reasons here:

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

When Bill Joy wrote c-shell, he never intended it to be a replacement for the user shell. It just sort of ended up being one.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Aug 25, 2003, 01:11 PM
 
Why is tcsh so bad? I find it very warm and cozy.

     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
Aug 25, 2003, 01:28 PM
 
Originally posted by misc:
'bout time.

Read this article on the differences between the shells.
Oh how I agree. Also that FAQ is a bit dated (1997). bash has changed a few more of those "N"s to "Y"s (as possibly others have done).
-DU-...etc...
     
Addicted to MacNN
Join Date: Aug 2000
Location: Retired
Status: Offline
Reply With Quote
Aug 25, 2003, 04:33 PM
 
bash, finally! I actually got used to using tcsh but I'll be happy to go back to bash.
Power Macintosh Dual G4
SGI Indigo2 6.5.21f
     
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
Aug 25, 2003, 05:31 PM
 
It happens that tcsh and bash users discuss the pros and cons of 'their' shells as emotional as folks do in threads about the best OS X browser here.
Fact is that shell scripts are usually written in sh which is a subset of bash and both parties stick to that. But then half of the Unix world uses tcsh as interactive shell because it is better configurable or this or that. I think everyone has to find out on their own. You'll find lots of related discussions on the web if you search a bit.

The reason that Apple might turn to bash as default is that tcsh does not support some character encoding (or so I've heard... can be wrong though). But they will still let you choose like you can do now, just the setting for the default shell changes.

-
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Aug 25, 2003, 05:46 PM
 
I have rather grown used to tcsh, but my experience with other shells was never anything too advanced that was not unlike any other shell, so for the most part, they're all the same to me.

I suppose I could be wooed to another shell because all I really do in the command line is... use command line programs. I think aliases are the only thing that I do in tcsh that are not the same in other shells. That and setting environment variables (via setenv) are the only things that I think are different in tcsh from other shells.

No? Pleae enlighten me.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Aug 25, 2003, 06:08 PM
 
Tcsh is the shell that you use to interact. Bash has been the shell that is executed by scripts. You can set the interactive shell to whichever one you choose in OS X.

Bash is being used as the interactive shell because it recognizes Unicode/UTF-8 encoding. The Unicode base character set allows the internationalization and support for multi-byte languages- such as Japanese.

HTH
Craig
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Aug 25, 2003, 07:40 PM
 
Originally posted by Arkham_c:
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

When Bill Joy wrote c-shell, he never intended it to be a replacement for the user shell. It just sort of ended up being one.
tcsh is fine, and fwiw, that FAQ is frequently linked by people who love bash -- but a lot of the flaws in csh were fixed in tcsh. there's absolutely nothing wrong with using tcsh as a login shell. by the same token, there's nothing wrong per se with bash either, although I don't like it at ALL.

I use zsh anyway, so I always have to change the prefs.

People act like this is some MASSIVE change in the OS or something, but it's not really a big deal, since you can easily change your shell back to tcsh and keep on using it normally...takes all of 3 seconds. I strongly recommend that if you are familiar and comfortable in tcsh, don't switch! There are differences between shells, but the most important thing is that you know how to use one of them well.

I'd be interested to hear why Apple is changing the default (the best guess is probably for some "compatibility" with Linux), but I really don't think it's worth it to go out and start reading up on bash. Just switch to tcsh. It's fine...
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 25, 2003, 08:12 PM
 
Originally posted by gorgonzola:
I'd be interested to hear why Apple is changing the default (the best guess is probably for some "compatibility" with Linux), but I really don't think it's worth it to go out and start reading up on bash. Just switch to tcsh. It's fine...
It's really an internationalization issue. Bash supports unicode (UTF-8 and UTF-16) and AFAIK tcsh does not.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Aug 26, 2003, 02:02 AM
 
Hmm...Interesting. You're right. I can cd to directories with Japanese characters in them just fine when I switch from tcsh to bash, where it was terribly hard under tcsh.
[Wevah setPostCount:[Wevah postCount] + 1];
     
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
Aug 26, 2003, 02:19 AM
 
It seems though there are ways to have tcsh support UTF-8, so maybe the last word isn't spoken there.
At the moment 16-bit characters in the terminal don't seem to work with either shell for me so I don't see a difference, but it's the first time I try

-
(Last edited by Moonray; Aug 26, 2003 at 02:33 AM. )
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Aug 26, 2003, 01:18 PM
 
I wonder why Apple favored tcsh to begin with? I suspect that once we put our comfort zone shell preferences aside, we will note that there had to to a good argument for shipping tcsh when other options were clearly available.
     
Zim
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status: Offline
Reply With Quote
Aug 26, 2003, 02:59 PM
 
Perhaps most importantly, there exists

"chsh"

so we can all have whatever we want (thank goodness).

Mike
(very happy user of tcsh for many many years)
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Aug 26, 2003, 03:28 PM
 
Apple changed the shell because it is percieved as an emerging standard (Linux ships with it), not because it is better. After all, the most common operating system out there is Windows, and I don't find it superior to anything. I challenge anyone here to show a feature that is in bash that is not zsh - I can't find one, and I really did try. The linked article says that you can't specify the startup file in zsh - this is incorrect, you can set environment variables like ZDOTDIR to tweak this.

As for csh-style vs. sh-style... Don't go there. Historically, csh and tcsh was first to add many improvements to the interactive side of things, which is why Apple chose tcsh. There are, generally speaking, three rules:

* Use whatever shell you like best, but do try new shells if you have the time.
* Never assume that anyone else uses the same shell as you do.
* Never write scripts for anything but old-style sh.
     
Dedicated MacNNer
Join Date: Jul 2002
Location: Boston, MA
Status: Offline
Reply With Quote
Aug 26, 2003, 05:30 PM
 
I don't see the big deal. All the scripting I do I use /bin/sh personally or hack up someone else's PERL code.

Also, isn't bash built into Jaguar anyway. Just change your login shell in Netinfo. Problem solved.

Can we have a flamewar about vi and emacs next please?

Oooo Ooooo, lets rant about the proper pronunciation of GIF. Another timeless classic.

Ahhhhhh, good times...............
     
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
Aug 26, 2003, 05:32 PM
 
The current Linux distributions ship with 'all' usuable shells, which one becomes the default shell for an user might be different from one Linux to the other, and you might get asked for your preference when you install it.

Some reasons to use tcsh as login shell and not bash are that tcsh provides a spelling correction, has programmable auto-completion and that you can't forget to 'export' environment variables. These are points that make tcsh more comfortable to use and that's perhaps why Apple chose it.
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Aug 27, 2003, 08:19 PM
 
Originally posted by DaGuy:
I wonder why Apple favored tcsh to begin with? I suspect that once we put our comfort zone shell preferences aside, we will note that there had to to a good argument for shipping tcsh when other options were clearly available.
Well, *BSD uses tcsh by default, and that's where Mac OS X comes from. FreeBSD uses tcsh. I dunno about bash becoming an emerging standard...it's certainly better for more "standard" shell scripts, but for interactive use, just Linux using it discounts the whole BSD family which is more relevant for Apple. So historical reasons, I guess.

Arkham -- thanks, I remember reading that now about the internationalization thing.

Actually, it looks like Apple Legal has gotten over its crippling fear of the GPL...

And yeah, about zsh, I think the zsh developers have stated pretty clearly that every feature of every other interactive shell can be enabled in zsh (though it may not be enabled by default). I've certainly found a ridiculous number of features in it. zmv is pretty neat...you could do that with scripting without too much trouble, but it's just really convenient. (It's a batch file rename tool.)
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Aug 28, 2003, 03:50 PM
 
Originally posted by gorgonzola:
Actually, it looks like Apple Legal has gotten over its crippling fear of the GPL...
Now if they'll just replace pax with tar in the installer so our symlinks will work again. I don't know how many times that bug has been reported to Apple, but the only response is that Legal wants to avoid the GPL...
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Online
Reply With Quote
Aug 29, 2003, 05:38 AM
 
What do you mean recent? Quite some time ago.

Other than that, I think the reason is that bash is the standard shell on all Linux systems that I have used. It can do calculations of floating points directly etc.
I don't suffer from insanity, I enjoy every minute of it.
     
Fresh-Faced Recruit
Join Date: Nov 2002
Location: mentalspace
Status: Offline
Reply With Quote
Sep 1, 2003, 09:19 PM
 
Originally posted by P:
Apple changed the shell because it is percieved as an emerging standard (Linux ships with it), not because it is better. After all, the most common operating system out there is Windows, and I don't find it superior to anything. I challenge anyone here to show a feature that is in bash that is not zsh - I can't find one, and I really did try. The linked article says that you can't specify the startup file in zsh - this is incorrect, you can set environment variables like ZDOTDIR to tweak this.

As for csh-style vs. sh-style... Don't go there. Historically, csh and tcsh was first to add many improvements to the interactive side of things, which is why Apple chose tcsh. There are, generally speaking, three rules:

* Use whatever shell you like best, but do try new shells if you have the time.
* Never assume that anyone else uses the same shell as you do.
* Never write scripts for anything but old-style sh.
As you say an "emerging standard" sounds about right.

With a touch of this perception maybe. . . FreeBSD and tcsh is where OSX came from but an association with IBM/Linux/Bash is where things are going . . . | . . .to get interesting in the future, as more enterprises follow the lead of those who have already adopted Linux. (One may laugh now, but as more big names legitimize Linux in the enterprise*, the herd mentality may take over, and a stampede may follow, leaving MSFT holding the subscription software bag) I think Apple wants to be a part of that future (Axis of Bash-ville vs Axxis of Eevil?). Heck even Computer Associates is getting it.**

I don't know if Apple still advertise in the Linux mags like they were doing last year, but I suspect they'd like Linux developers to come on board, and moving to bash as default, seems like a practical move in terms of encouraging developer expertise to head on over, as well as a 'symbolic gesture.'
Maybe in time to come and with PPC 970 Apple makes inroads into the high end of that market (http://www.macnn.com/news/20827).

*
"In one of the most significant announcements yet, ERP giant SAP is poised to outline plans for its own Linux product. Full details won't be issued until the CeBIT trade show later this month"

http://linuxtoday.com/developer/1999030200209PS


And on CAI

**http://linuxtoday.com/it_management/2003071600826INSWDV
(Last edited by dumkwestchun; Sep 1, 2003 at 09:30 PM. )
The only dumkwestchun is the one you're afraid to ask.
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Sep 15, 2003, 06:10 PM
 
I wonder why Apple favored tcsh to begin with? I suspect that once we put our comfort zone shell preferences aside, we will note that there had to to a good argument for shipping tcsh when other options were clearly available.
Rumor had it (back in the Public Beta days) that Apple engineers originally wanted to ship bash as the default shell, but Apple legal didn't like the licensing, so bash wasn't included as part of MacOS X 10.0; tcsh, therefore, was a second choice. If true, then including bash with Jaguar, and making it default in Panther, would seem to be part of a logical progression leading to a realization of the original vision.
     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:12 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2