zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Running additional shell startup commands
Date: Thu, 30 Jul 2015 08:55:45 +0100	[thread overview]
Message-ID: <20150730075545.GA21220@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAFiR=Jud0BG4r0jDK6O7_xEUu=9Gt-e6SEjVrp44anSNWvfFQw@mail.gmail.com>


> On 30 July 2015 at 07:24, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> > Often, I ssh to another machine, and the first thing I do there is
> > to change the working directory, e.g.
> >
> >   $ ssh <some machine>
> >   $ cd ~/src/git/...
> >
> > I'm looking for a way to specify that in some way on the ssh
> > command line but cannot figure out how to do that.  Zsh takes
> > either input from stdin, or from a command specified with -c, or
> > from a script, so things like
> >
> >   $ ssh <...> zsh -c 'cd ~/src/git' -s
> >
> > or
> >
> >   $ ssh <...> zsh -s <script>
> >
> > don't work.  The only thing I can think of would be to copy a
> > script to the machine with scp and source that at shell startup,
> > but that is way too much bother and too limited in application to
> > be useful (works only if the config on the target machine is
> > changed).
> >
> > (Is there a good reason why -s cannot be combined with -c or a
> > script name anyway?)

On Thu, Jul 30, 2015 at 08:45:00AM +0100, Mateusz Karbowy wrote:
> http://serverfault.com/questions/167416/change-directory-automatically-on-ssh-login

This does it:

  $ ssh -Y <machine> -t 'cd <dir>; exec zsh -i --login'
                    ^^^^

The "-t" is important.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany


  reply	other threads:[~2015-07-30  8:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30  6:24 Dominik Vogt
2015-07-30  7:45 ` Mateusz Karbowy
2015-07-30  7:55   ` Dominik Vogt [this message]
2015-07-30  9:31     ` Julien Jehannet
2015-07-30  7:49 ` lilydjwg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150730075545.GA21220@linux.vnet.ibm.com \
    --to=vogt@linux.vnet.ibm.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).