can I change/su user in the middle of a script?
if [ \"$user\" == \"\" ]; then echo \"Enter the table name\"; read user fi gunzip * chown postgres * su pos
You can use a here document to embed multiple su commands in your script:
su
if [ "$user" == "" ]; then echo "Enter the table name"; read user fi gunzip * chown postgres * su postgres <