and then I am asked to input the value i need to encrypt. This works but i need to be part of a bash script.
I need this to be part of an automated script and get the encrypted value as an output value (to put in the config file). How can I automate those steps in bash script?
This is a great question! Do you mind explaining a bit more about your use case? Are you using Infrastructure as Code of some type?
I believe sending the value you want over stdin should be sufficient, for example ( I sent stderr to /dev/null so you can see that the config value comes to stdout) :