README 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. http://www.opengroup.org/onlinepubs/9699919799/
  2. Open Group Base Specifications Issue 7
  3. http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html
  4. Shell & Utilities
  5. It says that any of the standard utilities may be implemented
  6. as a regular shell built-in. It gives a list of utilities which
  7. are usually implemented that way (and some of them can only
  8. be implemented as built-ins, like "alias"):
  9. alias
  10. bg
  11. cd
  12. command
  13. false
  14. fc
  15. fg
  16. getopts
  17. jobs
  18. kill
  19. newgrp
  20. pwd
  21. read
  22. true
  23. umask
  24. unalias
  25. wait
  26. http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
  27. Shell Command Language
  28. It says that shell must implement special built-ins. Special built-ins
  29. differ from regular ones by the fact that variable assignments
  30. done on special builtin are *PRESERVED*. That is,
  31. VAR=VAL special_builtin; echo $VAR
  32. should print VAL.
  33. (Another distinction is that an error in special built-in should
  34. abort the shell, but this is not such a critical difference,
  35. and moreover, at least bash's "set" does not follow this rule,
  36. which is even codified in autoconf configure logic now...)
  37. List of special builtins:
  38. . file
  39. : [argument...]
  40. break [n]
  41. continue [n]
  42. eval [argument...]
  43. exec [command [argument...]]
  44. exit [n]
  45. export name[=word]...
  46. export -p
  47. readonly name[=word]...
  48. readonly -p
  49. return [n]
  50. set [-abCefhmnuvx] [-o option] [argument...]
  51. set [+abCefhmnuvx] [+o option] [argument...]
  52. set -- [argument...]
  53. set -o
  54. set +o
  55. shift [n]
  56. times
  57. trap n [condition...]
  58. trap [action condition...]
  59. unset [-fv] name...
  60. In practice, no one uses this obscure feature - none of these builtins
  61. gives any special reasons to play such dirty tricks.
  62. However. This section also says that *function invocation* should act
  63. similar to special built-in. That is, variable assignments
  64. done on function invocation should be preserved after function invocation.
  65. This is significant: it is not unthinkable to want to run a function
  66. with some variables set to special values. But because of the above,
  67. it does not work: variable will "leak" out of the function.