-
😴 @jyn514this is IMPECCABLE work i was on the edge of my seat the whole time
i do want to mention that you can get further with the
<( $(cat custom-bashrc) )
approach if you just add more quotes x3; ssh -t linode "bash --rcfile <( echo '""$(cat custom-bashrc)""' )" linode-static:~$
but it breaks again as soon as you do anything complicated (e.g. my real bashrc):
; ssh -t linode "bash --rcfile <( echo '""$(cat .bashrc)""' )" zsh:98: unmatched ' zsh:98: parse error near `<( echo 'if [ -n "$B...' Connection to 50.116.47.176 closed.
-
😴 @jyn514ok here is a version that doesn't require smuggling environment variables and works for arbitrary numbers of files and arbitrarily weird syntax
$ (x=$(cat .bashrc); ssh -t linode "$(declare -p x)"'; exec bash --rcfile <(echo "$x")')
this also does not set any variables in your parent shell, because that's stateful and we don't want to be stateful
Edited by Jynn Nelson -
😴 @jyn514extended to vim alias:
ssh -t -o RemoteCommand="$(ssescape x); $(ssescape y);"'exec bash --rcfile <(echo "$x"; echo "alias vim='\''vim -u <(echo "$y")'\''"; )' "$@"
-
This reminds me of
https://github.com/sineemore/backpack
There are many forks with very minor changes if you poke around github.
Please register or sign in to comment