Pass carriage return to a command
Guys,
How can I pass carriage return to a command. I am writing a shell script whcih generates ssh key pair. It ask for input from user three times. I want to pass carriage return (ie. press Enter button) to this command. Is tehre any way? Thanks, Ravi |
Are you using the ssh-keygen command? Basically you will be prompted for key name and twice for the passphrase, unless you provide them with options. For example:
Code:
ssh-keygen -N "" -f goofy |
Colucix,
Thanks for the reply. And yes I am using ssh-keygen command to generate ssh key pair. But I am not after creating empty passphrase. I basically want to pass NOTHING when it prompts for key name or passphrases and need to do it through a script in order to avoid manual intervention. -Ravi |
Hmm... maybe I'm missing something. The -N option with an empty string as argument equals to pass NOTHING when prompted for passphrase. Also when you hit return without entering a string when prompted for key name, it will create a default key, being either $HOME/.ssh/id_rsa or $HOME/.ssh/id_dsa depending on the key type, so that you can give the default name along with the -f option. If I've not understood the problem, please tell me and elaborate further.
|
I am using below:
ssh-keygen -N "" -t dsa and it asked me for passphrase! $ ssh-keygen -N "" -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/testid/.ssh/id_dsa): Quote:
|
From your last post it looks like it asks the key name, not the passphrase. Please try:
Code:
ssh-keygen -N "" -t dsa -f $HOME/.ssh/id_dsa |
Bingo!
It worked. Thanks a ton colucix! :-) |
You're welcome! :)
|
say_hi_ravi,
If you'd like this moved to Programming, ask by using the "Report" button. |
All times are GMT -5. The time now is 09:51 AM. |