[Page 328 (continued)]8.12. Built-Ins The C shell provides the following extra built-ins: The next few subsections describe each built-in. 8.12.1. chdir Figure 8-37 describes the chdir shell command. [Page 329]Figure 8-37. Description of the chdir shell command.Shell Command: chdir [ path ] | chdir works the same as cd; it changes your current working directory to the specified directory. |
8.12.2. glob Figure 8-38 describes the glob shell command. Figure 8-38. Description of the glob shell command.Shell Command: glob { arg } | glob works the same as echo, printing a list of args after they have been processed by the shell metacharacter mechanisms. The difference is that the list of args is delimited by nulls (ASCII 0) in the final output instead of spaces. This makes the output ideally suited for use by C programs that like strings to be terminated by null characters. |
8.12.3. source When a script is executed, it is interpreted by a subshell. Any aliases and/or local variable assignments performed by the script therefore have no effect on the original shell. If you want a script to be interpreted by the current shell, and thus affect it, use the built-in source command, as described in Figure 8-39. Figure 8-39. Description of the source shell command.Shell Command: source [ -h ] fileName | source causes a shell to execute every command in the script called fileName without invoking a subshell. The commands in the script are only placed in the history list if the -h option is used. It is perfectly legal for fileName to contain further source commands. If an error occurs during the execution of fileName, control is returned to the original shell. |
In the following example, I used source to re-execute an edited ".login" file. The only other way to re-execute it would have been to log out and then log back in again. % vim .login ...edit my .login file. ... % source .login ...re-execute it. Enter your terminal type (default is vt100): vt52 % _ |