1

I was working on a script that logs in to UAT server, reroute to necessary folder and activates the virtual environment.

Following is the script:

function gotouat(){
    branch=`getBranchName`;
    echo "Logging into uat for branch $branch";
    ssh -t uat "cd ../projects/$branch && source envproj/bin/activate; zsh";
}

This script reroutes to the necessary branch, but does not start virtual environment.

Following are the debug logs:

debug1: Sending command: cd ../projects/test-branch && source envproj/bin/activate; zsh

debug2: channel 1: request exec confirm 1

debug2: callback done

debug2: channel 1: open confirm rwindow 0 rmax 32768

debug2: channel_input_status_confirm: type 99 id 1

debug2: PTY allocation request accepted on channel 1

debug2: channel 1: rcvd adjust 2097152

debug2: channel_input_status_confirm: type 99 id 1

debug2: exec request accepted on channel 1

Any help would be appreciated! Also this is my first post, so apologize for any missing information/issues.

Thanks!

7
  • Did you try to provide full path to zsh? Apr 11, 2016 at 11:26
  • Yes. I tried that. I even tried using && instead of 2 commands but no luck.
    – Rajesh
    Apr 11, 2016 at 11:30
  • So, in your case zsh is not starting at all, right? Apr 11, 2016 at 11:33
  • No. zsh is starting but virtual environment for project is not starting. So I have to rerun source envproj/activate/bin
    – Rajesh
    Apr 11, 2016 at 11:38
  • source loads and runs the content of a file in the current shell session. The zsh statement from your function creates a new session. Starting an interactive zsh and passing a script to run is not possible without some extra work. This post on the ZSH mailing list shows one way, there might be others.
    – Adaephon
    Apr 11, 2016 at 12:29

0

You must log in to answer this question.

Browse other questions tagged .