diff --git a/modules/ssh-alias/README.md b/modules/ssh-alias/README.md new file mode 100644 index 00000000..d552dd65 --- /dev/null +++ b/modules/ssh-alias/README.md @@ -0,0 +1,13 @@ +SSH Alias +========= + +Create aliases for connecting to hosts defined in the local ~/.ssh/config file + +Usage +----- +Load the module in your zpreztorc file. An alias will be created for each host defined in your ~/.ssh/config file. +In order to connect to a host, you just need to type its host name as it appears in ~/.ssh/config + +Authors +------- + - [Roey Darwish Dror](https://github.com/r-darwish) diff --git a/modules/ssh-alias/init.zsh b/modules/ssh-alias/init.zsh index 61b7bce0..ec777e19 100644 --- a/modules/ssh-alias/init.zsh +++ b/modules/ssh-alias/init.zsh @@ -1,3 +1,10 @@ +# +# Create aliases for hosts defined in ~/.ssh/config +# +# Authors: +# Roey Darwish Dror +# + local x for x in $(grep 'Host ' ~/.ssh/config | awk '{ print $2 }'); do alias $x="ssh $x"