Files
tldr/pages.zh/common/echo.md
2024-12-18 15:31:36 +05:30

29 lines
701 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# echo
> 输出给定参数。
> 更多信息:<https://www.gnu.org/software/coreutils/manual/html_node/echo-invocation.html>.
- 输出文本信息. 注意: 引号是可选的:
`echo "{{Hello World}}"`
- 输出带有环境变量的信息:
`echo "{{My path is $PATH}}"`
- 打印不带尾随换行符的信息:
`echo -n "{{Hello World}}"`
- 向文件添加信息:
`echo "{{Hello World}}" >> {{file.txt}}`
- 启用反斜杠转义的解释(特殊字符):
`echo -e "{{Column 1\tColumn 2}}"`
- 输出执行的上一条指令的退出状态(注:在 Windows 命令提示符和 PowerShell 中,对应的命令分别是 `echo %errorlevel%``$lastexitcode`
`echo $?`