echo.rst 988 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. echo command
  2. ============
  3. Synopsis
  4. --------
  5. ::
  6. echo [-n] [args ...]
  7. Description
  8. -----------
  9. The echo command prints its arguments to the console separated by spaces.
  10. -n
  11. Do not print a line feed after the last argument.
  12. args
  13. Arguments to be printed. The arguments are evaluated before being passed to
  14. the command.
  15. Examples
  16. --------
  17. Strings are parsed before the arguments are passed to the echo command:
  18. ::
  19. => echo "a" 'b' c
  20. a b c
  21. =>
  22. Observe how variables included in strings are handled:
  23. ::
  24. => setenv var X; echo "a)" ${var} 'b)' '${var}' c) ${var}
  25. a) X b) ${var} c) X
  26. =>
  27. -n suppresses the line feed:
  28. ::
  29. => echo -n 1 2 3; echo a b c
  30. 1 2 3a b c
  31. => echo -n 1 2 3
  32. 1 2 3=>
  33. A more complex example:
  34. ::
  35. => for i in a b c; do for j in 1 2 3; do echo -n "${i}${j}, "; done; echo; done;
  36. a1, a2, a3,
  37. b1, b2, b3,
  38. c1, c2, c3,
  39. =>
  40. Return value
  41. ------------
  42. The return value $? is always set to 0 (true).