change command exit code so it always returns 0

45 Views Asked by At

I'm trying to run a cli command which returns non zero status code if it doesn't runs successfully. however, how can I capture the error code in such a way that when I run

echo $?

It will display 0 as the exit code

Currently when I do this

aws route53domains register-domain --region us-east-1 --cli-input-json file://1-test-example-com.json > /dev/null 2>&1 

the exit code is 254 which that's the command exit code, however ideally I would like it the exit code to be 0.

I need it to display 0 exit code as if its anything else other than this the pipeline fails.

0

There are 0 best solutions below