I'm looking to create a script than can find a specific date/time based on a field in a database Currently i do it manually...
# psql gttvdb -U postgres
gttvdb=# select patch_date from version_history where version ='1.1.1';
What i need is to be able to reference that date as a variable in a bash script
#! /bin/sh
patchdate=$("select patch_date from version_history where version ='1.1.1';")
echo "last update was " $patchdate
Try this:
patchdate=` psql -t -q -c "select patch_date from version_history where version ='1.1.1'"`
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