-su: 意外标记 '(' 附近的语法错误

-su: syntax error near unexpected token '('

我遇到错误:

-su: syntax error near unexpected token '(`

这是我运行 shell中的脚本:

psql -c CREATE TABLE test1 (device SERIAL)

如果我已经在 postgres 中并且我 运行 下面的命令创建一个 table 它有效,

CREATE TABLE test (device SERIAL)

有谁知道我该如何解决这个问题?谢谢

尝试引用您要执行的命令。

psql -c "CREATE TABLE test1 (device SERIAL)"

psql -c 'CREATE TABLE test1 (device SERIAL)'

否则 Shell 以不同的方式解析命令并尝试使用每个 space 分隔的标记作为另一个参数:

psql -c CREATE ...Gibberish other arguments psql does not understand...