1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 04:15:24 +02:00
tldr/pages/common/echo.md
Pranaov S 8bc9dce9b1
pages/common/*: correct urls, see also improvements, unbashify pages, examples addition (#16841)
Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2025-06-14 19:02:15 +03:00

764 B

echo

Print given arguments. See also: printf. More information: https://www.gnu.org/software/coreutils/manual/html_node/echo-invocation.html.

  • 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 $?