Bash script to generate and change Java keystore passwords
It is a good practice to have the script tested on shellcheck.net so that you have a convention.



In the initialise section, you are cleaning up the keystore file (if it exists). Use the shell-builtin echo and redirect to achieve this:

echo "" &gt; $config_file




The password_length can become a global value instead of being local to set_key_passphrase.



You can avoid the double echo in the set_keystore_password by using tee:

echo "$password" | tee -a "$config_file"