source: MondoRescue/branches/3.2/mindi-busybox/shell/README

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