Computing.Net > Forums > Unix > Zsh as login shell, and shell in VI

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Zsh as login shell, and shell in VI

Reply to Message Icon

Name: Infinite Recursion
Date: November 21, 2003 at 07:30:05 Pacific
OS: Solaris
CPU/Ram: na
Comment:

I am running SecureCRT, using ssh2 to connect to a remote Solaris box that I do not have root access on.

My shell is set the /bin/csh and I rather run /bin/zsh due to me needing to use cursor keys to move back through the shell's command history.

I've tried the following to change shells to zsh..

1) In my .login, I placed...
if ( -f /bin/zsh ) exec /bin/zsh -l

2) In my .login I placed...
setenv SHELL /bin/zsh

3) Tried to edit /etc/passwd to point my shell to /bin/zsh instead of /bin/csh, but the file is read only obviously and I don't want to have to edit it with my limited sudo privileges anyway.

When I echo $SHELL after each of those changes and both at the same time. My shell is still listed as /bin/csh. I am thinking this is due to the fact that the admin do not have /bin/zsh in the /etc/shells config file. Could that be the problem, if so or if not... How can I change my shell
indirectly as I login?

---

Also cursor keys in VI would be nice too (the main reason, that I am trying to change shells). I tried typing...
:set shell=/bin/zsh
while in VI, but it was a no go. I think
it got hammered for the same reason as above, the /etc/shells file.

Does anyone know a workaround for this? Or exactly how to keep cursor keys escape sequences from being displayed and not executed? I looked at termcap and terminfo but it was fairly confusing.

Any ideas are appreciated...

Thanks in advance,

IR



Sponsored Link
Ads by Google

Response Number 1
Name: WilliamRobertson
Date: November 24, 2003 at 01:19:23 Pacific
Reply:

Good choice - zsh is way better than csh and deserves to be used more (though bash and tcsh also provide cursor key navigation and tab expansion, as does ksh93 which you can download free from http://www.research.att.com/sw/download if it isn't provided and the powers that be allow it).

Try placing the following in your .cshrc:

if ( $?prompt && $?term ) then
setenv ENV ~/.kshrc
exec /bin/zsh
endif

(Keep a session open while you test logging in so you can fix it if it doesn't work.) The above works for me with a tcsh default shell on Solaris, and seems OK for csh.

This conditionally replaces the current process with a zsh process, for interactive logins only (otherwise it would fire for every subshell).

The key mappings in vi are not related to the shell AFAIK. The value of $TERM can make some difference, but the easiest workaround is to use vi's :map function to set up mappings in your .exrc file, using Ctrl-V to capture the control key sequence. e.g. enter

map [Ctrl-V][Cursor-up] k
map [Ctrl-V][Cursor-down] j
map [Ctrl-V][Cursor-left] h
map [Ctrl-V][Cursor-right] l

where [Cursor-up] etc represent the actual keys. You should see something like

:map ^[[A k

You can test these out on the vi command line. In your .exrc file omit the initial ":".

To map keys in insert mode, use ":map!":

map! [Ctrl-V][Cursor-up] [Ctrl-V][Esc]ka
map! [Ctrl-V][Cursor-down] [Ctrl-V][Esc]ja
map! [Ctrl-V][Cursor-left] [Ctrl-V][Esc]la
map! [Ctrl-V][Cursor-left] [Ctrl-V][Esc]i

hth


0
Reply to Message Icon

Related Posts

See More


changing directories used-defined functions in...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Zsh as login shell, and shell in VI

Changing shell in Korn script www.computing.net/answers/unix/changing-shell-in-korn-script/4747.html

control J in vi www.computing.net/answers/unix/control-j-in-vi/5398.html

question in vi www.computing.net/answers/unix/question-in-vi/4770.html