Removing single quotes from sed using shell script

Viewed 29

sed adding single quotes to the password at the end which is causing problem while docker login

We are using sed to add escape "\" for special characters.

PASSWORD=P98Wle409G+H:DKuFU}S

local_REGISTRY_TOKEN="$(echo $PASSWORD | sed 's/[!@}:;+#$%^&*()-]/\\&/g')"

docker login -u ''$USERNAME'' -p ${local_REGISTRY_TOKEN} ''$REGION''.ocir.io

Output:

+ docker login -u test@oracle.com -p '98Wle409G\+H\:DKuFU\}' bom.ocir.io

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get "https://bom.ocir.io/v2/": unknown: Unauthorized
0 Answers
Related