Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.9: Updating SSH private keys' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.9: Updating SSH private keys
Authored by: Strod on Feb 18, '14 11:02:42AM
A little esoteric for the average Mac user who doesn't knowingly work with public/private keys, but very valuable for those who do. On the other hand, I found interesting the creative use of brackets in the second line:
cp id_rsa{,.bak}
That will certainly come in handy in the future.

[ Reply to This | # ]
10.9: Updating SSH private keys
Authored by: aMacUzur on Feb 18, '14 02:48:25PM

For those who don't know, that's brace expansion and the shell will expand it to become ("cp id_rsa" and nothing plus "cp id_rsa" plus ".bak"):
cp id_rsa id_rsa.bak
(see the "Brace Expansion" section in the bash man page)

While I wouldn't use it like that, since I prefer plain clarity over brevity (and that form is actually harder for me to type), brace expansion can be quite useful, especially when used with variables. E.G.,
a=1
b=5
eval echo foo{$a..$b}
yields
foo1 foo2 foo3 foo4 foo5



[ Reply to This | # ]