alias has unwanted space in it
Hi gang:
I'm trying to create an alias that will copy my public key to other servers. I created this alias in .bashrc: Code:
alias copykey='ssh-copy-id root@$1' Code:
copykey server1 Code:
ssh-copy-id root@ server1 Thanks, Rick |
Try a function instead (in your .bashrc)
Code:
function copykey { ssh-copy-id root@"$1"; } Code:
user@lm ~ $ copykey server1 |
thesnow is correct, but I thought I would provide the explanation for your issue.
Aliases do not accept parameters and even if they did you would not get the desired result. You need to think of the alias as a cut and paste. So whatever you assign to your alias will directly replace the name of the alias. So if you could accept parameters, your output would have looked like: Code:
$ alias copykey='ssh-copy-id root@$1' |
All times are GMT -5. The time now is 07:28 AM. |