which unix shell is best?
-
I have been using tcsh for a number of years now ( at least 12), and it seems that most OSes and most users have moved on to something better. Is there a reason for me to change, and if so, what is the best shell out there? ( main os is OSX 10.5, but use all sorts of linux/unix OSs ). To be honest, while there are a few things that tcsh is clunky at, I am relatively happy with it. I am moving alot of my shell scripts over to python, so tcsh might not be so bad, but I would like to keep myself learning new things. any advice?
-
Answer:
Pretty much everyone I know in the past ten years has learned bash, and these days bash is the default for most distro installs. Why? I'm not sure. I know that I'm more comfortable in bash because coming from a web scripting world the scripting syntax makes more sense to me ... but I haven't done enough tcsh to know the difference. My suspicion is that since /etc/rc and cronrc files and other base system shell scripts *MUST* be written in bash, tcsh and csh have fallen into disuse as switching syntaxes all the time can cause some serious problems in absent-minded sysadmins' heads... not to mention their systems.
brent_h at Ask.Metafilter.Com Visit the source
Other answers
I still use tcsh, even now that I'm off the BSDs and onto Debian (laptop, sigh). I like the syntax, I like the way it behaves, and, more importantly, I already have my .cshrc just the way I want it, and I'll be damned if I'm going to spend the hour or two it'd take to port it over to bash. I'll also never give up vi! I used zsh for a while, and it wasn't bad, but I didn't get particularly attached to any of it's features. And I'll echo everything everyone has said about shell scripting... aside from a little bit of sh scripting, and my .*rc files, I've never touched it - if it's a one-liner, tcsh + awk/sed/xargs will do fine. If it's more than that, perl is your friend.
devilsbrigade
#!/bin/bash
flabdablet
bash. bash. bash. (bonk on the head), bash. 20 years ago t?csh was cool, a nice improvement over the standard /bin/sh. Every cool person used it. Not anymore, bash, bash, bash... I fight the urge to smack t?csh users upside the head with a dead fish almost every day. No serious geek would use anything else. Use t?csh/zsh/ksh for personal use if it pleases you, but the world runs on bash/sh... (and Perl 5.6.1 or 5.8.3 depending on OS). t?csh is for greybeard sandal wearing old-timer people... bash, bash, bash...
zengargoyle
Bash seems to be winning the popularity contest these days, but it's been a long time since I've used a machine that didn't have both a bash-like and C shell. So I don't think there's any reason for you to change if you don't want to. Personally, I prefer ksh, but I don't have a ton of real arguments for its superiority over bash; I just have always used it and don't have any compelling reasons to change.
Kadin2048
I used to know that scripting-wise, it was best to write for a standard shell that you could be confident would be present on almost any system your script ended up on, which generally meant a sort of POSIX compliant shell, usually bin/sh. For personal interactive-command stuff, you picked whatever you felt comfortable with. As a sysadmin, I tried to stick with whatever the default was, so I'd notice problems before the users did. I don't know what the kids are using these days. Probably some combination of Ruby and a Wii controller.
tew
I use zsh for interactive/command-line, and made the transition from tcsh to bash to zsh years ago. Completion, globbing, etc. There are plenty of sample dotfiles for zsh, too. But I don't script with the shell: the most I'll do are loops through lists of files.
holgate
I'm quite happy with tcsh aside from a few niggles I'm sure you're familiar with. It's a highly underrated interactive shell, even if it's crap for scripting (but then, so are all the other shell scripting languages, urgh). Programmable completion, plenty of configuration options, decent usability.. I don't really think I'd gain much switching to zsh (except I'd have to install it myself in a lot of places) or bash (except I'd have to port all my existing settings). The crap stderr handling I encounter rarely enough that I can just drop into sh if I really need to get around it. Really, I've used bash and zsh. The things I liked about them I found I could usually do just as well in tcsh, and it comes in the base system for most of my systems, so why not use it? I like learning new things too, but new shells don't seem to be a particularly good use of my time.
Freaky
I was hard core tcsh user, as it was the first I learnt. But if you do scripts, you tend to always use "sh" to be compatible. (yes, sh, not bash! Stop assuming it's bash linuxers! I'm looking at you!) So I ended up "having to know" both bash style and tcsh style, ways of doing things. (foreach vs for and all that). So just using bash made it easier, and made me be better at making the scripts. Once I made the prompts look the same, it was no difference. Then I discovered a couple of bonus features, I really love ^R now (like emacs, search backwards in history), and I found UTF-8 (Japanese) to work more easily in bash. But really either shell is fine to use, it was just easier to use/memorise just one subset.
lundman
jeffamaphone-I prefer PowerShell. The OP said he's using Mac OS X and various Linux/Unixes. PowerShell is totally irrelevant for his needs, since it does not run on anything but Windows. SpecialK-My suspicion is that since /etc/rc and cronrc files and other base system shell scripts *MUST* be written in bash, tcsh and csh have fallen into disuse as switching syntaxes all the time can cause some serious problems in absent-minded sysadmins' heads... not to mention their systems. Actually, base system shell scripts are usually executed with whatever the system's default is for /bin/sh. That is usually bash these days, but for instance, Ubuntu uses dash, not bash. Best practice is to avoid "bashisms", and write your base system shell scripts as POSIX shell scripts that will work no matter what the system's default shell.
evariste
Related Q & A:
- How to execute Unix shell script from Windows?Best solution by Stack Overflow
- Which crusher is the best?Best solution by Yahoo! Answers
- Which climbing shoes are best?Best solution by Yahoo! Answers
- Which Forum Snowboard is best?Best solution by Yahoo! Answers
- Which skates are the best?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.