gpt4 book ai didi

postgresql - psql shell 命令执行与\!

转载 作者:行者123 更新时间:2023-11-29 11:22:38 24 4
gpt4 key购买 nike

有什么方法可以捕获 shell 输出(在 psql 变量中)和/或使用 \!psql 内部运行 shell 命令的退出代码? documentation没有提供任何细节。

最佳答案

使用 \!\o..

你可以像这样把两者结合起来,

  • \! echo “选择1;” > bar(运行命令 echo "SELECT 1;"SELECT 1; 的输出重定向到 bar)
  • \o bar(运行bar中的命令)

关于postgresql - psql shell 命令执行与\!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32189818/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com