Entrada de entrada em um comando? [duplicado]

1

Estou executando um comando por meio de um programa que precisa criar uma conta do OpenVPN. Depois de colocar esta linha para começar a fazer a conta:

cd /etc/openvpn/easy-rsa; . ./vars; ./build-key username

Eu preciso que ele não coloque nenhuma entrada 10 vezes [como pressionar enter,] e pressione y duas vezes. Precisa estar tudo nessa linha. Isso é possível? Agradecemos antecipadamente.

EDITAR:

root@suffice-vpn:~# cd /etc/openvpn/easy-rsa; . ./vars; <<<$'\n\n\n\n\n\n\n\n\n\nyy' ./build-key username
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
Generating a 2048 bit RSA private key
..............+++
.....................+++
writing new private key to 'username.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:State or Province Name (full name) [NY]:Locality Name (eg, city) [Merrick]:Organization Name (eg, company) [IceWare]:Organizational Unit Name (eg, section) [IceWare]:Common Name (eg, your name or your server's hostname) [username]:Name [server]:Email Address [[email protected]]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:An optional company name []:Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'US'
stateOrProvinceName   :PRINTABLE:'NY'
localityName          :PRINTABLE:'Merrick'
organizationName      :PRINTABLE:'IceWare'
organizationalUnitName:PRINTABLE:'IceWare'
commonName            :PRINTABLE:'username'
name                  :PRINTABLE:'server'
emailAddress          :IA5STRING:'[email protected]'
Certificate is to be certified until Jan 14 16:59:03 2026 GMT (3650 days)
Sign the certificate? [y/n]:CERTIFICATE WILL NOT BE CERTIFIED: I/O error
root@suffice-vpn:/etc/openvpn/easy-rsa#

Como você pode ver, ele passa pelo processo preenchendo os espaços em branco [mantendo todas as informações que eu quero que permaneçam as mesmas], mas eu recebo este erro de E / S.

    
por Justin G 17.01.2016 / 16:50

1 resposta

3

Eu resolvi usando este comando:

cd /etc/openvpn/easy-rsa; . ./vars; ./build-key --batch username
    
por Justin G 17.01.2016 / 21:25