Vishal Verma Vishal Verma - 1 year ago 63
Bash Question

Is there a way to input automatically when running a script?

I am trying to execute a script file which asks for password as input. Is there any way we give the command the input it needs automatically?
It's in psql which has parameter

for username but no parameter for password.


exa00009@exa00009:~$ sh
Password for user xyz:

Answer Source

You can provide command line argument for your script like below: sh yourInput and in your script get it as var input=$1 and use accordingly.

This question is already answered here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download