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!
zsh
? – user1700494 Apr 11 '16 at 11:26&&
instead of 2 commands but no luck. – Rajesh Apr 11 '16 at 11:30zsh
is not starting at all, right? – user1700494 Apr 11 '16 at 11:33source envproj/activate/bin
– Rajesh Apr 11 '16 at 11:38source
loads and runs the content of a file in the current shell session. Thezsh
statement from your function creates a new session. Starting an interactivezsh
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 '16 at 12:29zsh
and the other aboutbash
? Also the answer to the supposed original question employ mechanismszsh
does not have (--rcfile
) or will probably not work withvirtualenv
(SendEnv
). – Adaephon Apr 12 '16 at 04:51