how to include variable value in command argument in the shell script?
Get rid of the command
variable and the $(...)
command substitution. You can call keytool
directly like you did at the command line:
update_keystore() {
keystore_file_path="/data/cert/keystore.jks"
keystore_password="pass@word"
temp_cert_path="/data/cert/temp_cert_file.cer"
cert_alias="root"
keytool -importcert -file "$temp_cert_path" -keystore "$keystore_file_path" -alias "$cert_alias" -keypass "$keystore_password" -storepass "$keystore_password" -noprompt
}