* Using zsh from another shell
@ 2014-03-26 8:37 Florian Lindner
2014-03-26 8:52 ` Guyzmo
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Florian Lindner @ 2014-03-26 8:37 UTC (permalink / raw)
To: zsh-users
Hello,
I have a SSH account on a machine where I can't change the shell. The
default login shell is tcsh. Right now I invoke zsh by calling it as the
last command in ~/.cshrc. It seems to work fine except that I need to
type exit twice to close the session.
Are there any other potential problems I haven't noticed so far?
Is there a way to work around the twice exit issue?
Is there a recommended way of using/invoking zsh in this situation?
Thanks a lot,
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using zsh from another shell
2014-03-26 8:37 Using zsh from another shell Florian Lindner
@ 2014-03-26 8:52 ` Guyzmo
2014-03-26 10:52 ` Pauric Ward
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Guyzmo @ 2014-03-26 8:52 UTC (permalink / raw)
To: Florian Lindner; +Cc: zsh-users
Hi,
On Wed, Mar 26, 2014 at 09:37:22AM +0100, Florian Lindner wrote:
> I have a SSH account on a machine where I can't change the shell. The
> default login shell is tcsh. Right now I invoke zsh by calling it as the
> last command in ~/.cshrc. It seems to work fine except that I need to type
> exit twice to close the session.
> Are there any other potential problems I haven't noticed so far?
you should'nt have any problem so far, I have done that for a while
when my university was forcing us to use ksh. I then had all my favorite
tools compiled in my account, and shared those with all the other nerdy
students at the time.
> Is there a way to work around the twice exit issue?
> Is there a recommended way of using/invoking zsh in this situation?
well, you don't need to exit twice, just do:
exec /path/to/zsh
and it will replace your tcsh shell instance with zsh's.
HTH,
--
Guyzmo
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Using zsh from another shell
2014-03-26 8:37 Using zsh from another shell Florian Lindner
2014-03-26 8:52 ` Guyzmo
@ 2014-03-26 10:52 ` Pauric Ward
2014-03-26 11:23 ` Peter Stephenson
2014-03-27 17:47 ` Wayne Davison
3 siblings, 0 replies; 6+ messages in thread
From: Pauric Ward @ 2014-03-26 10:52 UTC (permalink / raw)
To: 'zsh-users@zsh.org'
On one system I regularly use, there are a lot of machines using YP/NIS.
I had initially used ypchsh, but found that I couldn't log into boxes that didn't have zsh installed.
My workaround is that I just use ssh aliases now.
$ alias box6
box6='ssh -t myusername@someNISbox-06 "exec zsh"'
-----Original Message-----
From: Florian Lindner [mailto:mailinglists@xgm.de]
Sent: 26 March 2014 08:37
To: zsh-users@zsh.org
Subject: Using zsh from another shell
Hello,
I have a SSH account on a machine where I can't change the shell. The
default login shell is tcsh. Right now I invoke zsh by calling it as the
last command in ~/.cshrc. It seems to work fine except that I need to
type exit twice to close the session.
Are there any other potential problems I haven't noticed so far?
Is there a way to work around the twice exit issue?
Is there a recommended way of using/invoking zsh in this situation?
Thanks a lot,
Florian
________________________________________________________
This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using zsh from another shell
2014-03-26 8:37 Using zsh from another shell Florian Lindner
2014-03-26 8:52 ` Guyzmo
2014-03-26 10:52 ` Pauric Ward
@ 2014-03-26 11:23 ` Peter Stephenson
2014-03-27 17:47 ` Wayne Davison
3 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2014-03-26 11:23 UTC (permalink / raw)
To: zsh-users
On Wed, 26 Mar 2014 09:37:22 +0100
Florian Lindner <mailinglists@xgm.de> wrote:
> I have a SSH account on a machine where I can't change the shell. The
> default login shell is tcsh. Right now I invoke zsh by calling it as the
> last command in ~/.cshrc. It seems to work fine except that I need to
> type exit twice to close the session.
>
> Are there any other potential problems I haven't noticed so far?
> Is there a way to work around the twice exit issue?
> Is there a recommended way of using/invoking zsh in this situation?
The information from the FAQ might help.
1.7: I don't have root access: how do I make zsh my login shell?
Unfortunately, on many machines you can't use `chsh' to change your
shell unless the name of the shell is contained in /etc/shells, so if
you have your own copy of zsh you need some sleight-of-hand to use it
when you log on. (Simply typing `zsh' is not really a solution since
you still have your original login shell waiting for when you exit.)
The basic idea is to use `exec <zsh-path>' to replace the current
shell with zsh. Often you can do this in a login file such as .profile
(if your shell is sh or ksh) or .login (if it's csh). Make sure you
have some way of altering the file (e.g. via FTP) before you try this as
`exec' is often rather unforgiving.
If you have zsh in a subdirectory `bin' of your home directory,
put this in .profile:
[ -f $HOME/bin/zsh ] && exec $HOME/bin/zsh -l
or if your login shell is csh or tcsh, put this in .login:
if ( -f ~/bin/zsh ) exec ~/bin/zsh -l
(in each case the `-l' tells zsh it is a login shell).
If you want to check this works before committing yourself to it,
you can make the login shell ask whether to exec zsh. The following
work for Bourne-like shells:
[ -f $HOME/bin/zsh ] && {
echo "Type Y to run zsh: \c"
read line
[ "$line" = Y ] && exec $HOME/bin/zsh -l
}
and for C-shell-like shells:
if ( -f ~/bin/zsh ) then
echo -n "Type Y to run zsh: "
if ( "$<" == Y ) exec ~/bin/zsh -l
endif
It's not a good idea to put this (even without the -l) into .cshrc,
at least without some tests on what the csh is supposed to be doing,
as that will cause _every_ instance of csh to turn into a zsh and
will cause csh scripts (yes, unfortunately some people write these)
which do not call `csh -f' to fail. If you want to tell xterm to
run zsh, change the SHELL environment variable to the full path of
zsh at the same time as you exec zsh (in fact, this is sensible for
consistency even if you aren't using xterm). If you have to exec
zsh from your .cshrc, a minimum safety check is `if ($?prompt) exec
zsh'.
If you like your login shell to appear in the process list as `-zsh',
you can link `zsh' to `-zsh' (e.g. by `ln -s ~/bin/zsh
~/bin/-zsh') and change the exec to `exec -zsh'. (Make sure
`-zsh' is in your path.) This has the same effect as the `-l'
option.
Footnote: if you DO have root access, make sure zsh goes in
/etc/shells on all appropriate machines, including NIS clients, or you
may have problems with FTP to that machine.
--
Peter Stephenson <p.stephenson@samsung.com> Principal Software Engineer
Tel: +44 (0)1223 434724 Samsung Cambridge Solution Centre
St John's House, St John's Innovation Park, Cowley Road,
Cambridge, CB4 0DS, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using zsh from another shell
2014-03-26 8:37 Using zsh from another shell Florian Lindner
` (2 preceding siblings ...)
2014-03-26 11:23 ` Peter Stephenson
@ 2014-03-27 17:47 ` Wayne Davison
2014-03-27 17:50 ` Wayne Davison
3 siblings, 1 reply; 6+ messages in thread
From: Wayne Davison @ 2014-03-27 17:47 UTC (permalink / raw)
To: Florian Lindner; +Cc: Zsh list
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
On Wed, Mar 26, 2014 at 1:37 AM, Florian Lindner <mailinglists@xgm.de>wrote:
> Is there a recommended way of using/invoking zsh in this situation?
>
I like to leave the remote host side alone and tweak my ssh command to run
zsh by default if I'm not running a command. i.e.:
ssh () { if [[ $# = 1 ]]; then set -- -t $1 zsh -l fi if [[ $# = 2 && "$1"
= '-q' ]]; then set -- -tq $2 zsh -l fi command ssh $@}
That way I can "ssh host" or "ssh -q host" to any host and still get zsh as
my default shell. If I ever get an error that zsh isn't available, I just
run "zsh -t host" and it logs in with the default shell.
..wayne..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using zsh from another shell
2014-03-27 17:47 ` Wayne Davison
@ 2014-03-27 17:50 ` Wayne Davison
0 siblings, 0 replies; 6+ messages in thread
From: Wayne Davison @ 2014-03-27 17:50 UTC (permalink / raw)
To: Florian Lindner; +Cc: Zsh list
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
On Thu, Mar 27, 2014 at 10:47 AM, Wayne Davison <wayne@thedavisons.net>wrote:
> ssh () { if [[ $# = 1 ]]; then set -- -t $1 zsh -l fi if [[ $# = 2 && "$1"
> = '-q' ]]; then set -- -tq $2 zsh -l fi command ssh $@}
>
Hmm, I'm not sure why that lost all its newlines -- must be some weird
paste interaction. I'm sure you can figure it out, though.
..wayne..
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-27 17:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 8:37 Using zsh from another shell Florian Lindner
2014-03-26 8:52 ` Guyzmo
2014-03-26 10:52 ` Pauric Ward
2014-03-26 11:23 ` Peter Stephenson
2014-03-27 17:47 ` Wayne Davison
2014-03-27 17:50 ` Wayne Davison
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).