TCSH issue

Polytropon freebsd at
Fri Sep 26 01:59:02 UTC 2014

On Thu, 25 Sep 2014 10:06:58 -0600, Dave Babb wrote:
> Upon a recommendation of a fellow and very experienced FreeBSD user...I 
> have switched from bash to tcsh as my user shell.  I have not and will 
> not change the root's shell from sh.

The dialog shell for root is also the C shell; sh is the
system's standard scripting shell, as well as the suggestion
for the maintenance shell in single user mode.

> Let me explain: If I fat finger something into the cli....lets say 
> "freeecolor -om"....If I was to place my cursor on the last "e" and 
> backspace...everythings fine...However if I put my cursor on that same 
> letter and press the delete doesn't delete the letter, rather 
> it inserts a tilde "~". "sh" behaves the same way on my system.

What you're experiencing here is a "problem" with the setting
of the terminal emulator (what codes are generated by keys)
and the shell (how shell actions are defined in keyboard
control sequences). The shell prints the "code" for the key
when it doesn't know what to do with it.

> Does anyone know how I can correct this behavior?

I have the following addition in /etc/csh.cshrc so all user
shells inherit the setting:

if ($?prompt) then
	# ... stuff omitted ...
	if ( $?tcsh ) then
		bindkey "^W" backward-delete-word
		bindkey -k up history-search-backward
		bindkey -k down history-search-forward
	bindkey ^? delete-char		# for console
	bindkey ^[[3~ delete-char	# for xterm

The last two "bindkey" lines should make sure the delete key
does what you rightfully expect it to do. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list