Please note, I did not write any of these script, Java code, or the application and I am restricted as to what I can modify in these scripts.
I have a Bash script that starts a Java console /foo/bar/myscript.sh
. Specified inside, it calls to start the Java console but prompts for a password before the shell is launched. I am trying to pass a command into the Java console that executes a backup procedure for an application.
Is there a way to run the script which passes the password? The password is not set via Bash but somewhere in Java and I don't know the variable name.
Is there also a way to pass the Java method in the same line? This is the normal, manual process:
./myScript.sh
Please enter password: myPassword
javaConsole % backup.method("/backup/dir");
Obviously this isn't correct but ideally, a command would go like this:echo myPassword | ./myscript.sh | backup.method("/backup/dir");