As I am working through an SSH- related literature and arrived at passwordless login, I stumbled on a piece of (for me at least) unusual syntax namely doubling the single quotes:
ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -C ''-N''
Notice those single quotes that are around -N, those are typed twice. And are not backticks.
I know the meaning and results you get from single quotes in the bash world and also went through man page of ssh-keygen and am familiar with all the options for ssh-keygen, but why is -N within doubled single quotes? -C is for entering comments and the string is normally enclosed in double quotes, as can be expected. So why is -N option enclosed in single quotes twice (-N allows you to enter a passphrase)?
I’m fairly sure in your case it has no effect at all except to concatenate
two zero-length strings with the -N so it’s a waste of four bytes. I’ll
accept more-informed answers but in this case if you are copying/pasting
this from somewhere either the string was munged or it was done
deliberately to look nicer or something, or the person writing the example
thought it had some magical meaning that I do not think it has.
Good luck.
On 04/08/2010 12:56 PM, varelov wrote:
>
> As I am working through an SSH- related literature and arrived at
> passwordless login, I stumbled on a piece of (for me at least) unusual
> syntax namely doubling the single quotes:
>
> Code:
> --------------------
> ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -C ‘’-N’’
> --------------------
>
> Notice those single quotes that are around -N, those are typed twice.
> And are not backticks.
> I know the meaning and results you get from single quotes in the bash
> world and also went through man page of ssh-keygen and am familiar with
> all the options for ssh-keygen, but why is -N within doubled single
> quotes? -C is for entering comments and the string is normally enclosed
> in double quotes, as can be expected. So why is -N option enclosed in
> single quotes twice (-N allows you to enter a passphrase)?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
I re-typed that command from a walk-through on how to achieve passwordless login (not copy-pasted it just for the reason you mentioned, munging the original string). That syntax is unique to that tutorial, and I found other tutorials on the subject- none of them used the doubled single quotes…
Thank you for the clarification, now I can be at peace with my bash skills…
I’ve seen typos which are less benign creep into online tutorials through lack of care by the writer. Notably substitution of quotes by “smart quotes” produced by word processors. You cut and paste the command and are sorely puzzled when it doesn’t work. Then you curse when you realise what’s happened.