I want to print the error in assigned variable
#!/bin/bash
a=$(vertica copy query) # if i got error here
echo $a
I want to print the error in assigned variable
#!/bin/bash
a=$(vertica copy query) # if i got error here
echo $a
You need redirect stderr to stdout with 2>&1, then you can get the error if the command have error:
#!/bin/bash
a=$(vertica copy query 2>&1) # if i got error here
echo $a