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
?&&
instead of 2 commands but no luck.zsh
is not starting at all, right?source envproj/activate/bin
source
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.