You can, but bash won’t run the subsequent commands as postgres. Instead, do:
su postgres -c 'dropdb $user'
The -c
flag runs a command as the user (see man su
).
You can, but bash won’t run the subsequent commands as postgres. Instead, do:
su postgres -c 'dropdb $user'
The -c
flag runs a command as the user (see man su
).