\echo
将求值后的参数打印到标准输出,用空格分隔,并在末尾加上换行符。这对于在脚本输出中穿插信息很有用。例如:
当前查看 PostgreSQL 18.6。
说明
将求值后的参数打印到标准输出,用空格分隔,并在末尾加上换行符。这对于在脚本输出中穿插信息很有用。例如:
- 客户端
- psql 18.6
- 区分大小写的写法
- \echo
用法
\echo text [ ... ]本版手册中的写法
| 命令 | 手册中的后缀修饰符 |
|---|---|
| \echo | 此语法签名未列出 |
手册定义
\echotext[ ... ]-
将求值后的参数打印到标准输出,用空格分隔,并在末尾加上换行符。这对于在脚本输出中穿插信息很有用。例如:
=>
\echo `date`Tue Oct 26 21:40:57 CEST 1999如果第一个参数是未加引号的
-n,则不会写入尾随的换行符(也不会写入第一个参数)。提示
如果使用
\o命令重定向查询输出,可能会想用\qecho代替这个命令。另请参阅\warn。
相关条目
文档与源码
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
版本比较
PostgreSQL 12 → 13: 属性变化。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 12
+++ PostgreSQL 13
@@ -1,5 +1,5 @@
{
- "definition": "Prints the arguments to the standard output, separated by one space and followed by a newline. This can be useful to intersperse information in the output of scripts. For example: => \\echo `date` Tue Oct 26 21:40:57 CEST 1999 If the first argument is an unquoted -n the trailing newline is not written. Tip If you use the \\o command to redirect your query output you might wish to use \\qecho instead of this command.",
+ "definition": "Prints the evaluated arguments to standard output, separated by spaces and followed by a newline. This can be useful to intersperse information in the output of scripts. For example: => \\echo `date` Tue Oct 26 21:40:57 CEST 1999 If the first argument is an unquoted -n the trailing newline is not written (nor is the first argument). Tip If you use the \\o command to redirect your query output you might wish to use \\qecho instead of this command. See also \\warn .",
"modifiers": [],
"signature": "\\echo text [ ... ]",
"spellings": [
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回psql 命令 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。