# changed shell from bash to sh HELP



## DigiSoft (Jan 20, 2010)

Ok so I've changed my shell from bash to sh but now when I use the arrow keys I only get ^[[A^[[B etc etc.

It is not recording commands anymore why? Can I fix this somehow?

Thank you.


----------



## crsd (Jan 20, 2010)

sh isn't really supposed to be used as interactive shell. Try using (t)csh.


----------



## fronclynne (Jan 20, 2010)

sh(1) suggests starting with -E for emacs editing mode or -v for vi editing mode.  As for history, I don't know.  Honestly, I don't use /bin/sh interactively any more than I must.


----------



## Beastie (Jan 20, 2010)

FreeBSD has no bash, unless you installed it yourself. It has sh and (t)csh, with the latter for root and whatever you chose for your user(s).

Yes can you can fix it. The same way you just did it, only this time in the opposite way. 
Since bash is a port, you won't find it in /bin but in /usr/local/bin.

Hint: chpass(1) and [cmd=""]cat /etc/shells[/cmd].


----------



## DigiSoft (Jan 20, 2010)

but why is not working?

I am using /bin/sh on other accounts (users) and they work normal. Why root can't remember commands?


----------



## Beastie (Jan 20, 2010)

Could you *please* read my post? Root uses (t)csh by default, not sh.

Do an [cmd=""]echo $SHELL[/cmd] on your other accounts to see what they're using and I bet it'll say */bin/csh*. 

And one more thing: keep anything in the root account (e.g. shell) as it is by default.


----------



## DigiSoft (Jan 20, 2010)

Beastie said:
			
		

> Could you *please* read my post? Root uses (t)csh by default, not sh.
> 
> Do an [cmd=""]echo $SHELL[/cmd] on your other accounts to see what they're using and I bet it'll say */bin/csh*.
> 
> And one more thing: keep anything in the root account (e.g. shell) as it is by default.



Here you go from 5 accounts



> $  echo $SHELL
> /bin/sh
> $


----------



## SirDice (Jan 20, 2010)

Change the shell back to /bin/tcsh.


----------



## bb (Jan 20, 2010)

ok listen: command history is implemented in libedit. /bin/sh uses this library, and you can access history with the arrow keys by enabling emacs mode:

```
$ set -o emacs
```

Note that linux doesn't have a bourne shell: /bin/sh is a link to /bin/bash.

/bin/sh on freebsd doesn't have a completion feature though. You know what I mean: The thingy where you're hammering your tab key all the time when using bash.

Also note that bash is linked against libreadline, which is the gnu counterpart to libedit. All history related features like ^R (reverse history search) are implemented in this library and work differently from libedit.

So my guess is that what you really want is to use bash, and therefore you have to install it from the ports. But it is true that you should not change root's shell to bash for safety reasons. You can run sh and csh without /usr mounted so it is more likely to work. If root's shell cannot be started, your effectively locked out. So just start the bash manually after successfully logging in.


----------



## DigiSoft (Jan 20, 2010)

How can I safely return to /bin/tcsh ?
What command to use?


----------



## SirDice (Jan 20, 2010)

DigiSoft said:
			
		

> How can I safely return to /bin/tcsh ?


Yes.


> What command to use?


chsh(1)


----------



## Beastie (Jan 20, 2010)

Why do you think we bother replying? To remove the numbness from our fingers?
http://forums.freebsd.org/showpost.php?p=62934&postcount=4
Edit the temporary file and save it.

Alternatively use chsh(1) with the *-s* option followed by the full path of the desired shell.

Both utilities are hardlinked (they're the same).


----------



## DigiSoft (Jan 20, 2010)

Thank you. I've successfully changed my shell to csh
Admin you can mark this topic as Solved.


----------

