In my bash file I have the following
result=$(mysql --login-path=remote_user --database=mydatabase < "import.sql");
echo $result;
I am trying to capture the output so that if it errors I can email myself
When I run the command I get
ERROR 1062 (23000) at line 1:....
But $result is always empty so how can I assign / capture the error so that I can then use this in the email
Note: I have enforced the error so that I can test