# Bourne shell (/bin/sh) and Tcsh configuration



## keno (Jun 6, 2012)

Hi!

First of all I am glad to be back in the FreeBSD community. I haven't had a chance to work with FreeBSD since 6.2 I think. I mostly worked with flavors of Linux, so bash was my shell all these years. I could just install it from ports and forget about it, but I would like to avoid installing it on my sytems, since I believe FreeBSD built-in shells should be enough (unless you can prove me wrong).

OK, to the questions:

To my surprise I noticed that /bin/sh is actually very capable nowadays (at least on 9.0-RELEASE). It seems it fulfills most of my interactive shell needs, except some.


Is there a way to configure completion? I see from bind output that there is such a thing as sh-complete, but in no man page I can fine any info on this command. I guess it should have been mention in man editrc, but it isn't to my regret. By default it completes directory and file names pretty good. I only miss completing shell commands.

```
$ bind ^I
^I      ->      sh-complete
```

Is it possible to configure /bin/sh to save interactive shell history to file as tcsh and bash does?

Now regarding tcsh. Since it is much more complicated than /bin/sh there are lots and lots of options to play around with, but unfortunately I do not at the moment have time. Would be great to have it up and running as fast as I can. I mean defaults are OK to some extent, but I miss having to press ^D for completions instead just tabbing my way through.

Configure tcsh completion to work with [Tab] key only?

Any other configuration options for an ex-bash user?


----------



## wblock@ (Jun 6, 2012)

This tcsh thread has a lot of examples.

set autolist may be what you need.


----------



## lme@ (Jun 6, 2012)

Unfortunately, sh(1) doesn't support command completion, only path completion.
Same is true for a history file.


----------



## UNIXgod (Jun 6, 2012)

sh() is a posix compliant shell meant for scripting. It's meant to have no (or few) interactive features to provide speed of execution:

http://www.freebsd.org/doc/en/books/faq/applications.html#MINIMAL-SH


> 7.10. Why is /bin/sh so minimal? Why does FreeBSD not use bash or another shell?
> 
> Because POSIXÂ® says that there shall be such a shell.
> 
> ...



If you're interested in interactive features use csh and write your shell scripts in sh. If csh isn't your thing simply install one of the bourne derived shells from the ports and use it for interactive use. If you haven't had an opportunity zsh is a bourne/korn style shell with a large feature set when it comes to completion systems.

All bourne derived shells (ba|k|z)sh are compatible with ash syntax.


----------



## keno (Jun 7, 2012)

Well, in that case bash it is all the way.


----------

