Script only opens up Postgres but does not process any commands after that.
#/bin/bash
filename='mac_addresses.txt'
filelines=`cat $filename`
echo Start
for line in $filelines ; do
psql pcoip_mc_db postgres
update endpoint set endpoint_group_id = 15 where mac_address='$filelines';
\q
done
Expected results are to see this script go line by line in the mac_addresses.txt
file and, after connecting to Postgres, run this command on every mac address in mac_addresses.txt
:
update endpoint set endpoint_group_id = 15 where mac_address='$filelines';