I was attempting to automate the 'store user config' process, and the weblogic.Admin way of doing it wasn't behaving(complaining about invalid pad in the key), so I was defaulting back to the WLST command. I ran into the same problem described here. Since in my specific scenario, I needed some environment configuration that didn't translate properly, I needed a way to execute it directly in my bash script.
Using the following WLST script (here's the one from StackOverflow above)
I tried piping output directly into the command.... which didn't work!
After a coworker suggested "expect", I came up with the following solution...
The expect command will 'spawn' the java process. It will wait until it sees the "y or n" portion of output from the script, when it will then 'send' a y followed by a newline to the program.
The first line, 'set timeout -1' was because creating the key file takes longer then the default timeout in expect, so it would terminate early (leaving behind a 0 length userkey.secure file)