Bring your .bashrc
, .zshrc
, .vimrc
, etc. into any remote environments, such as ssh
, docker container (docker run
/ docker exec
/ kubectl exec
), and another user (su
).
Just use *rc
commands instead of original commands
sshrc xxx
instead ofssh xxx
- e.g.,
sshrc -p 10022 foo@XXX.XXX.XXX.XXX
- e.g.,
surc xxx
instead ofsu xxx
- e.g.,
surc foo
- e.g.,
dockerrc exec -it xxx
instead ofdocker exec -it xxx
- e.g.,
dockerrc exec -it foo_running_container bash
- e.g.,
dockerrc run -it xxx
instead ofdocker run -it xxx
- e.g.,
dockerrc run -it foo_image bash
- e.g.,
kubectlrc exec -it xxx
instead ofkubectl exec -it xxx
- e.g.,
kubectlrc exec -it foo_running_pod -- zsh
- e.g.,
Note: Incompatible subcommands (e.g., ps
for dockerrc
) will be passed to the original command (i.e., docker ps
will be executed).
# If you want to install the latest version, change version to master in the url and set VERSION
# VERSION: anyrc version (default: same as install script version)
# DIR: Where to install (default: /usr/local/bin)
# FORCE: If defined, override .anyrc (default: undefined)
## default installation example
curl -sS https://raw.githubusercontent.com/amaya382/anyrc/0.1.0/install.sh | bash
## fully-customized installation example
curl -sS https://raw.githubusercontent.com/amaya382/anyrc/master/install.sh | VERSION=master DIR=~/.local/bin FORCE=1 bash
# Put your dotfiles or create symlinks of them into $HOME/.anyrc.d
ln -s /path/to/your/dotfiles/.somedotfile $HOME/.anyrc.d/.somedotfile
See example as well.
ANYRC_DANYRC
: Path to.anyrc
. Default is in home dir or curr dirANYRC_DANYRCD
: Path to.anyrc.d
. Default is in home dir or curr dirANYRC_SSH_CMD
:ssh
command, i.e., you can useautossh
insteadANYRC_DOCKER_WO_TAR
: If set, will work w/otar
ondockerrc
ANYRC_K8S_WO_TAR
: If set, will work w/otar
onkubectlrc
ANYRC_WO_TAR
: If set, will work w/otar
on any remote environment
# sshrc will use autossh internally
ANYRC_SSH_CMD=autossh sshrc user@host
.anyrc
: Pre-configured for zsh, bash, tmux, git, and vim. If you want to support other tools, edit me..anyrc.d/*
: Dotfiles you want to bring into remote. Symlinks are allowed.
ANYRC_ENV
: Show remote environment (ssh
/su
/docker
/k8s
)ANYRC_ROOT
: Path to tmp dir including all anyrc-related files each connectionANYRC_HOME
: Path to dir for dotfilesANYRC_DANYRC
: Path to.anyrc
ANYRC_DANYRCD
: Path to.anyrc.d
See example
compdef dockerrc=docker
compdef kubectlrc=kubectl
ssh
- Attach w/ a login shell
docker run
- Attach w/ a specified shell
docker exec
- Attach w/ a specified shell
kubectl exec
- Attach w/ a specified shell
su
(work w/sudo
)- Attach w/ a login shell
- zsh
- bash
- tmux
- vim
- git
- etc. (can support other tools by editing
.anyrc
)
- Russell91/sshrc
- Using a lot of logics and codes from sshrc