# What shell do you think that is the best or what shell do you use?



## Mike0009 (Apr 20, 2013)

What shell do you think that is the better shell or what is your favourite shell?

I think that the better shell is the Bourne Again Shell (bash), because his scripting language is most powerful than the tcsh, csh and sh, but I think that the Korn Shell is good too.

So, my favourite shell is the Bourne Again Shell (Bash). What do you think and what is your favourite shell? I have got a lot of curiosity to know.

(Forgive my bad English, I have attempted to write the better I can, if I write something bad, feel free to correct me, I hope that one day a Spanish forum will exist.)


----------



## kpa (Apr 20, 2013)

In general I prefer bourne type shells over anything else. I use shells/zsh on my normal users but I have kept root's shell at the default csh(1) to avoid making a mess when updating/upgrading.


----------



## wblock@ (Apr 20, 2013)

Interactive use and scripting are two different things.  You don't have to pick one.  I write scripts in sh(1), but use csh(1) for interactive use.


----------



## fonz (Apr 20, 2013)

Mike0009 said:
			
		

> What shell do you think that is the better shell or what is your favourite shell?


For me it's almost the same as @wblock: csh for root, sh for scripting and tcsh for interactive use. The former two are pretty much standard, the latter is personal preference.


----------



## jrm@ (Apr 20, 2013)

Have you seen this thread?


----------



## kpedersen (Apr 20, 2013)

I use shells/bash for interactive use because that is often the default for most operating-systems and I can keep everything consistent without much fiddling.

My shell scripts use sh(1). I despise it when people write shell scripts in anything other than sh(1) or csh(1).


----------



## BlueCoder (Apr 20, 2013)

I vote for zsh. MIT licensed. A step up from bash in my opinion.

I also like ksh and I'm surprised since OpenBSD has it in it's main tree why FreeBSD hasn't also adopted it.


----------



## fullauto (Apr 20, 2013)

I use csh for my command line, but love bash for scripting.


----------



## DutchDaemon (Apr 20, 2013)

zsh for my personal wheel account
tcsh for a backup wheel account (in case zsh gets damaged or removed)
tcsh for the root account (backup)
zsh for the toor account (which I use for root)
sh for all shell scripts.


----------



## caesius (Apr 21, 2013)

fullauto said:
			
		

> I use csh for my command line, but love bash for scripting.



Out of curiosity, what do you find bash offers that sh does not (for scripting)?


----------



## jalla (Apr 21, 2013)

fonz said:
			
		

> csh for root, sh for scripting and tcsh for interactive use. The former two are pretty much standard, the latter is personal preference.



In FreeBSD csh and tcsh is the same thing. No need to separate them.


```
gong:~% ls -li /bin/{,t}csh
65840 -r-xr-xr-x  2 root  wheel  382432 Mar 19 20:44 /bin/csh*
65840 -r-xr-xr-x  2 root  wheel  382432 Mar 19 20:44 /bin/tcsh*
```


----------



## jalla (Apr 21, 2013)

kpedersen said:
			
		

> I use shells/bash for interactive use because that is often the default for most operating-systems and I can keep everything consistent without much fiddling.



Most operating systems? You actually mean Linux period, don't you?

I don't work much with Solaris, AIX, HP-UX, or Irix these days, but last I checked none of them had a native bash.


----------



## kpedersen (Apr 21, 2013)

Linux, Mac OS X, Solaris 11 and Cygwin represent the most common for me to use when not on FreeBSD which do have ol' bash  as the default.

The AIX and Solaris 10 around the Uni also had bash as the default (set by the admin though).

Solaris 10 by its nature had bash (and every other shell) included in its default install. The later versions are pretty much a Linux userland anyway so again... bash :/


----------



## fonz (Apr 21, 2013)

jalla said:
			
		

> In FreeBSD csh and tcsh is the same thing. No need to separate them.


Force of habit aside, I've found it more convenient to think of them as two different things because on systems other than FreeBSD, they just might be.


----------



## vermaden (Apr 21, 2013)

The zsh for interactive use (eventually fish).

The /bin/sh for scripts.


----------



## RichardM (Apr 21, 2013)

ksh for interactive use and most scripts, because of it's programmability, but mainly because that's what I've got used to in 20 years of Unix.. I also use HP-UX, so need something that's the same across HP-UX/FreeBSD/Linux.

Out of interest, is there much difference between ksh93 and pdksh? I think ksh93 is some sort of official version, but noticed that OpenBSD has moved to pdksh as a default shell. Are there any views on their relative merits?


----------



## throAU (Apr 22, 2013)

tcsh for my user accounts
sh for root/scripting

I don't do a hell of a lot of more complex scripting/automation these days, but if I do it's more likely to be in awk, perl or make.


----------



## kpedersen (Apr 22, 2013)

Thought I should also add this:

The CDE project provides a version of shells/ksh93 called dtksh which has been extended to support better integration with the CDE desktop.

So you can do cool things like create Motif Windows within your scripts which is much more powerful than x11/xdialog.


----------



## break19 (Apr 22, 2013)

I prefer shells/zsh for interactive, and just stick with sh for scripts.

I just `exec /usr/local/bin/zsh &` in my root .cshrc and get it for root. If it isn't there, all I get is "command not found"


----------



## ShelLuser (May 5, 2013)

I'm always late to the nice threads it seems, but then again I suppose better late than never 



			
				Mike0009 said:
			
		

> What shell do you think that is the better shell or what is your favourite shell?


It depends on the situation.

I kept the root user on csh, although I briefly considered changing it to something else. Eventually I actually ended up _preferring_ csh for root due to the fact that it can also somewhat "fail save" you in some cases. And although it does make it a bit harder on me to get used to setting up an iteration (for example), this also helps me keep things a bit more safe. For example:


```
smtp2:/home/peter $ for a in `ls`; do echo $a; done
Maildir
downloads
temp
...
```

vs.


```
peter@smtp2:/home/peter % foreach a ( `ls` )
foreach? echo $a
foreach? end
Maildir
downloads
temp
...
```
Although the csh session takes more commands and thus a little more time to use (for me at least, I'm a relative fast typist) it also forces you to think about the stuff you're doing. For me that's essential when using the root account, you can never be too careful with that.

For scripting I fully rely on /bin/sh. For the simple reason that I need to be sure that if I write a script for server 'A' it will also work on server 'B'. So I'm definitely resorting to the base system for that, also because I've yet to find something which I can't manage with sh.

And finally, for my personal user account I fully rely on shells/ksh93. Partly because this was my de-facto shell on the Solaris servers I used to work with, but also because ksh has always felt much cleaner to me. I personally prefer it over bash for example. Of course it helps being able to use vi blindfolded, so I'll take the ksh 'vi mode' (`$ set -o vi`) over the bash history/auto complete any day of the week.


----------



## zspider (May 6, 2013)

kpedersen said:
			
		

> Thought I should also add this:
> 
> The CDE project provides a version of shells/ksh93 called dtksh which has been extended to support better integration with the CDE desktop.
> 
> So you can do cool things like create Motif Windows within your scripts which is much more powerful than x11/xdialog.



Indeed you can, I gave up on that, didn't have enough understanding. The x11/xdialog sounds interesting though.


----------



## fluca1978 (May 6, 2013)

Well, for scripting I use sh(1) since it is the most portable (or ported), while for interactive use after years of using bash and a light period of csh(1) I switched to zsh(1), which has a lot of advanced features and seems to me superior to Bash. 

Effectively, I was surprised too to see OpenBSD having ksh in base, and in particular to see that a lot of scripting has been done for such shell (e.g., the sysmerge), while FreeBSD is stuck with csh and sh.


----------



## fonz (May 6, 2013)

fluca1978 said:
			
		

> Effectively, I was surprised too to see OpenBSD having ksh in base, and in particular to see that a lot of scripting has been done for such shell (e.g., the sysmerge), while FreeBSD is stuck with csh and sh.


Stuck may be the wrong word here. Plain sh(1) is still the most common and portable option for scripting. Do you happen to know whether the ksh scripting as apparently done by OpenBSD is compatible with sh or uses ksh specifics?


----------



## jrm@ (May 6, 2013)

vermaden said:
			
		

> The zsh for interactive use (eventually fish).



You might like this plugin, which I discovered via this blog post.  The plugin provides Fish-like syntax highlighting for Zsh.


----------



## fluca1978 (May 7, 2013)

fonz said:
			
		

> Stuck may be the wrong word here. Plain sh(1) is still the most common and portable option for scripting. Do you happen to know whether the ksh scripting as apparently done by OpenBSD is compatible with sh or uses ksh specifics?



I'm not fully sure, but the scripting done by OpenBSD folks should be ksh-ish, since they use associative arrays, that as far as I know are not available on sh. I also believe that they switched to ksh quite recently and only for some complex tasks, I don't believe all the whole scripting is done using ksh. Maybe someone here who uses OpenBSD more than me can clarify.


----------



## kpa (May 7, 2013)

Just my opinion but using ksh as the baseline shell for an operating system violates the "keep it simple, stupid" principle. Scripts that make use of the more advanced features of the ksh shell are essentially non-reusable in another context where the baseline is the basic sh(1). I guess OpenBSD can do that because they have such a tight leash on what goes into the OS and what doesn't.


----------



## vermaden (May 7, 2013)

jrm said:
			
		

> You might like this plugin, which I discovered via this blog post.  The plugin provides Fish-like syntax highlighting for Zsh.



Thanks, any screenshots?


----------



## jrm@ (May 7, 2013)

Here's one.


----------



## _martin (May 7, 2013)

When it comes to login shells one feature outstands in bash (so I think): command completion. The basic one is good enough. It's very comfortable, especially on a system you are not familiar with. You know command begins with "s", you hit the completion escape sequence and you see the list of all s* commands. This is priceless - absolutely perfect. 
To be fair, I've seen completion on other shells too. But the "bash way" suits me the best.

On FreeBSD I have bash even as root (yes, you can compile it so you don't bury yourself during crash, etc.). As I use HPUX a lot, I came to benefit from ksh features too. I like vi behavior.

When scripting posix sh is more than enough. At least in most cases.


----------



## wblock@ (May 7, 2013)

matoatlantis said:
			
		

> When it comes to login shells one feature outstands in bash (so I think): command completion. The basic one is good enough. It's very comfortable, especially on a system you are not familiar with. You know command begins with "s", you hit the completion escape sequence and you see the list of all s* commands. This is priceless - absolutely perfect.
> To be fair, I've seen completion on other shells too. But the "bash way" suits me the best.



How is that different from csh/tcsh?


----------



## _martin (May 7, 2013)

wblock@ said:
			
		

> How is that different from csh/tcsh?



It's been some time I've used csh, but I think it doesn't show all possible commands (in PATH) when nothing is written in command line.


----------



## wblock@ (May 7, 2013)

Try it again.  csh(1) actually has a pretty powerful completion mechanism.  See Thread 35129.


----------



## vermaden (May 8, 2013)

jrm said:
			
		

> Here's one.



Now I understand which PART of fish this implements in zsh, added, works great, thanks


----------



## j4ck (May 8, 2013)

bash forever


----------



## _martin (May 8, 2013)

wblock@ said:
			
		

> Try it again.  csh(1) actually has a pretty powerful completion mechanism.  See Thread 35129.



Hm .. sounds interesting, I'll have a look on that.


----------

