In a shell script, I need to pull a private key from a .pem
file. When I set my AUTORIZATION
variable to the path, the variable is only the filepath string, not the actual filepath.
If I change my AUTHORIZATION
variable to cat <FILE_PATH>
it imports the header and footer i.e. -----BEGIN RSA PRIVATE KEY... END RSA PRIVATE KEY-----
How do I pull out the RSA key without the header and footer?
CLUSTER=standalone
TENANT=climate
NAMESPACE=integration_test
AUTHORIZATION=$REPO_ROOT/pulsar/tls/broker/broker.key.pem
echo $AUTHORIZATION
# Create tenant
curl -L -X PUT "http://localhost:$HOST_PULSAR_PORT/admin/v2/tenants/$TENANT" \
--header "Authorization: Bearer $AUTHORIZATION" \
--header 'Content-Type: application/json' \
--data-raw "{\"allowedClusters\": [\"$CLUSTER\"]}"
CodePudding user response:
You may use cat
to get the output from the file location and then stored that to the variable
AUTHORIZATION=$(cat $REPO_ROOT/pulsar/tls/broker/broker.key.pem)