I want to create a variable with its name partly dynamic and export it from my bash shell script. I have been trying to do it the following way. No success though. Please tell me where I am wrong.
#!/bin/bash
CURRENT_PROCESS_ID=$$
var=METASTORE_JDBC_DRIVER_$CURRENT_PROCESS_ID
echo $var
export $var='1'
execution command
bash <filename>.sh
I am hoping the script would create an environmental variable like METASTORE_JDBC_DRIVER_8769
and I should be able to use that out of the script but when I do
echo $METASTORE_JDBC_DRIVER_8769
outside the script, doesn't give me anything. Any suggestions/ideas are welcomed.