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