I have a Postgres console command createdb appname_production_master
, which return error exit code if the database with this name already exists.
Is it possible to make this command do not return any exit code?
The signals 2 (SIGINT) , 3 (SIGQUIT) , and 20 (SIGTSTP) will be ignored by the shell process.
To silence the output of a command, we redirect either stdout or stderr — or both — to /dev/null. To select which stream to redirect, we need to provide the FD number to the redirection operator.
Exit When Any Command Fails This can actually be done with a single line using the set builtin command with the -e option. Putting this at the top of a bash script will cause the script to exit if any commands return a non-zero exit code.
If you are executing a Bash script in your terminal and need to stop it before it exits on its own, you can use the Ctrl + C combination on your keyboard.
Just ignore the exit code, for example like this.
createdb appname_production_master || true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With