更新时间:2023-12-05 14:30:28
可以,但是bash不会将后续命令作为postgres运行.而是:
You can, but bash won't run the subsequent commands as postgres. Instead, do:
su postgres -c 'dropdb $user'
-c
标志以用户身份运行命令(请参见 man su
).
The -c
flag runs a command as the user (see man su
).