posso modificare/su utente nel mezzo di uno script?posso eseguire 'su' nel mezzo di uno script bash?
if [ "$user" == "" ]; then
echo "Enter the table name";
read user
fi
gunzip *
chown postgres *
su postgres
dropdb $user
psql -c "create database $user with encoding 'unicode';" -U dbname template1
psql -d $user -f *.sql
possibile duplicato di [Come si usa su per eseguire il resto dello script bash come quell'utente?] (Http://stackoverflow.com/questions/1988249/how-do- i-use-su-to-execute-the-rest-of-the-bash-script-as-that-user) –