1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 13:42:07 +02:00
tldr/pages/common/echo.md
shreenidhi11 1c4e1d0a7a
echo: add exit code command (#10538)
* echo: add exit code command

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: Jack Lin <blueskyson1401@gmail.com>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2023-07-25 22:47:16 +05:30

28 lines
709 B
Markdown

# echo
> Print given arguments.
> More information: <https://www.gnu.org/software/coreutils/echo>.
- Print a text message. Note: quotes are optional:
`echo "{{Hello World}}"`
- Print a message with environment variables:
`echo "{{My path is $PATH}}"`
- Print a message without the trailing newline:
`echo -n "{{Hello World}}"`
- Append a message to the file:
`echo "{{Hello World}}" >> {{file.txt}}`
- Enable interpretation of backslash escapes (special characters):
`echo -e "{{Column 1\tColumn 2}}"`
- Print the exit status of the last executed command (Note: In Windows Command Prompt and PowerShell the equivalent commands are `echo %errorlevel%` and `$lastexitcode` respectively):
`echo $?`