X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc2;h=2bfb6775fc43c4c8f25ddb2ea61880336e891713;hb=f91bdcc85d4742254fefc2c9880a0c76dc2a65ed;hp=577631eed08c9a7a19161fc046d5047af73ebb82;hpb=66fc17f0f64763399d2314aab40b0b09ae08435d;p=distro-setup diff --git a/brc2 b/brc2 index 577631e..2bfb677 100644 --- a/brc2 +++ b/brc2 @@ -273,11 +273,11 @@ dup() { local ran_d ran_d=false case $PS1 in - *DISTRO-BEGIN*) + *DISTRO-BEGIN!*|*DISTRO!*) /b/ds/distro-begin || return $? ran_d=true ;;& - *DISTRO-END*) + *DISTRO-END!*|*DISTRO!*) /b/ds/distro-end || return $? ran_d=true ;;& @@ -938,13 +938,21 @@ sl() { # Theres a couple ways to do this. im not sure whats best, # but relying on bash 4.4+ escape quoting seems most reliable. command ssh "${args[@]}" "$remote" \ - BRC=t bash -c '"\"\$@\""' bash ${@@Q} + BRC=t bash -c '.\ .iank/.bashrc\;"\"\$@\""' bash ${@@Q} + elif [[ ! -t 0 ]]; then + # This case is when commands are being piped to ssh. + # Normally, no bashrc gets sourced. + # But, since we are doing all this, lets source it because we can. + cat <(echo . .iank/.bashrc) - | command ssh "${args[@]}" "$remote" BRC=t bash else - # -t gives us an interactive shell for normal ssh. -l makes us use the rcfile when piping commands. - command ssh -t "${args[@]}" "$remote" BRC=t INPUTRC=.iank/.inputrc bash --rcfile .iank/.bashrc -l + command ssh -t "${args[@]}" "$remote" BRC=t INPUTRC=.iank/.inputrc bash --rcfile .iank/.bashrc fi else - BRC=t command ssh "$remote" "$@" + if [[ -t 0 ]]; then + BRC=t command ssh "${args[@]}" "$remote" ${@@Q} + else + command ssh "${args[@]}" "$remote" BRC=t bash -l + fi fi } sss() { # ssh solo