I have a simple script creating database
#!/bin/sh
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
psql -d track -q -f "$DIR"/create.sql > RESULT
RESULT="$(psql -d track -q -f "$DIR"/create.sql)"
echo $RESULT
this:
$ bash MakeDB.sh > result
produces empty result file
psql produces some log info that is output to terminal, the thing is I can't redirect that info, I want to pass it further as a result.
Is there a way to store psql output? It would be best if it wasn't printed in the terminal.