I'd like to automate the process of syncing a local ~/bin
folder to a remote host, and adding that folder to my remote shell's path. I've got the syncing part done, but am not sure how to automate adding the folder to my remote shell's $PATH
.
This way I could always work on my shell scripts on my local machine, and if I have to connect to a new machine and start working on it, I could just run a local script to sync my ~/bin folder to the remote machine, and then run scripts on the remote host easily all the time.
So how can I ensure that my ~/bin
path is added to the $PATH
of the remote host, so the next time I login, the $PATH
is set correctly?
I'd like this to be done automatically from my shell script.
EDIT: I'd prefer not to sync a .bashrc
, but append to an existing file if need be by adding something to the end using a shell script.
~/.bashrc
and such as well as~/bin
?$PATH
is a one-off it would probably be easier just to edit.bash_profile
/.bashrc
and have done with it.PATH="$HOME/bin:$PATH
(or some such) to.bash_profile
or.bashrc
as part of your standard configuration. Once per host. Job done. It doesn't matter that$HOME/bin
might not exist.