Intel XENIX 286 Programmers Guide (86) - Tenox.tc
Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc
XENIX Programming csh: C Shell Sometimes a nu mber of locally developed programs reside in the directory /usr/local. If you want all C shells that you invoke to have access to these new programs, place the command set path =(. /bin /usr/bi n /usr/local) in the .cshrc file in your home directory. Try doing this, then logging out and back in. Type set to see that the value assigned to path has changed. When you log in, the C shell examines all directories in your path other than the current directory (.), to determine which commands are in those directories. The C shell remembers these commands in an internal table. This means that if a command is added to a directory in your search path after you have started the C shell, then the C shell may not find that command if you attempt to invoke it. If you want to use a command that has been added after you have logged in, give the command rehash to the C shell. rehash causes the shell to recompute its internal table of command locations, so that it will find the newly added command. Note that rehashing is not necessary for commands added to the current directory. Since the C shell has to look in the current directory on each command anyway, placing it at the end of the path specification usually works best and reduces overhead. Other useful built-in variables are home, which shows your home directory, and ignoreeof, which can be set in your .login file to tell the C shell not to exit when it receives an end-of-file from a terminal. The variable ignoreeof is one of several variables with values that the C shell does not care about; the C shell is only concerned with whether these variables are set or unset. Thus, to set ignoreeof you simply type set ignoreeof and to unset it type unset ignoreeof Some other useful built-in C shell variables are noclobber and mail. The syntax > filename which redirects the standard output of a command just as in the regular shell, overwrites and destroys the previous contents of the named file. In this way, you may accidentally overwrite a valuable file. If you prefer that the C shell not overwrite files in this way, type set noclobber 8-3
csh: C Shell XENIX Programming in your .login file. After setting noclobber, typing date > now causes an error message if the file now already exists. You can type date >! now if you really want to overwrite the contents of now. The " > !" is a special syntax indicating that overwriting or "clobbering" the file is permitted. (The space between the exclamation point (!) and the word "now" is critical here, as "!now" would be an invocation of the history mechanism (described below) and would have a very different effect.) Using the C Shell History List The C shell can maintain a history list containing the text of previous commands. You can use a notation that reuses commands, or words from commands, in forming new commands. This notation can be used to repeat previous commands or to correct minor typing mistakes in commands. The following example gives a sample session using the history mechanism of the C shell. The example assumes that the bug.c file exists and that its contents are exactly as shown below. Boldface indicates user input. 8-4 % cat bug.c main( ) { printf("hello); } % cc !$ cc bug.c bug.c (5) : warning 8: newline in string constant bug.c (5): error 59 : syntax error: ' } ' % ed !$ ed bug.c 29 * 4s/);/");/p printf(" hello"); *w 30 * q % !c cc bug.c % a.out hello% !e ed bug.c 30 * 4s/lo/lo\\n/p pri ntf(" hello\n ");
- Page 108 and 109: XENIX Programming adb: Program Debu
- Page 110 and 111: XENIX Programming adb: Program Debu
- Page 112 and 113: XENIX Programming adb: Program Debu
- Page 114 and 115: XENIX Programming adb: Program Debu
- Page 116 and 117: XENIX Programming int fcnt,gcnt,hcn
- Page 118 and 119: XENIX Programming adb: Program Debu
- Page 120 and 121: XENIX Programming adb: Program Debu
- Page 122 and 123: XENIX Programming adb: Program Debu
- Page 124 and 125: XENIX Programming adb: Program Debu
- Page 126 and 127: XENIX Programming adb: Program Debu
- Page 128: XENIX Programming adb: Program Debu
- Page 131 and 132: as: A sse m bier XENIX Programming
- Page 133 and 134: as: Assembler XENIX Programming The
- Page 135 and 136: as: Assembler XENIX Programming Key
- Page 137 and 138: as: Assembler The combination rules
- Page 139 and 140: as: Assembler XENIX Programming Ins
- Page 141 and 142: as: Assembler Initial Value Directi
- Page 143 and 144: as: Assembler XENIX Programming int
- Page 145 and 146: as: A sse m bier sub subb test test
- Page 147 and 148: as: Assembler XENIX Programming lnt
- Page 149 and 150: as: Assembler XENIX Programming lnt
- Page 151 and 152: as: Assembler XENIX Programming Imm
- Page 153 and 154: as: A sse m bier XENIX Programming
- Page 156 and 157: CHAPTER 8 csh : C SHEll The C shell
- Page 160 and 161: XENIX Programm ing *w 32 * q % !c -
- Page 162 and 163: XENIX Programming csh: C Shell the
- Page 164 and 165: XENIX Programming csh: C Shell Usin
- Page 166 and 167: XENIX Programming csh: C Shell Usin
- Page 168 and 169: XENIX Programming csh: C Shell The
- Page 170 and 171: XENIX Programming csh: C Shell Note
- Page 172 and 173: XENIX Programming switch ( string c
- Page 174 and 175: XENIX Programming csh: C Shell Star
- Page 176 and 177: XENIX Programming csh: C Shell Spec
- Page 178 and 179: CHAPTER 9 lex : LEXICAL ANA LYZER G
- Page 180 and 181: XENIX Programming lex: Lexical Anal
- Page 182 and 183: XENIX Programming lex: Lexical Anal
- Page 184 and 185: XENIX Programming lex: Lexical Anal
- Page 186 and 187: XENIX Programming lex: Lexical Anal
- Page 188 and 189: XENIX Programming lex: Lexical Anal
- Page 190 and 191: XENIX Programming lex: Lexical Anal
- Page 192 and 193: XENIX Programm ing lex: Lexical Ana
- Page 194 and 195: XENIX Programming Specifying Source
- Page 196 and 197: XENIX Programming lex: Lexical Anal
- Page 198 and 199: XENIX Programming lex: Lexical Anal
- Page 200 and 201: XENIX Programming The definitions s
- Page 202 and 203: CHAPTER 10 yacc: COMPILER-COMPILER
- Page 204 and 205: XENIX Programming yacc: Compiler-Co
- Page 206 and 207: XENIX Programming yacc: Compiler-Co
<strong>XENIX</strong> Programming csh: C Shell<br />
Sometimes a nu mber of locally developed programs reside in the directory /usr/local. If<br />
you want all C shells that you invoke to have access to these new programs, place the<br />
command<br />
set path =(. /bin /usr/bi n /usr/local)<br />
in the .cshrc file in your home directory. Try doing this, then logging out and back in.<br />
Type<br />
set<br />
to see that the value assigned to path has changed.<br />
When you log in, the C shell examines all directories in your path other than the current<br />
directory (.), to determine which commands are in those directories. The C shell<br />
remembers these commands in an internal table. This means that if a command is added<br />
to a directory in your search path after you have started the C shell, then the C shell<br />
may not find that command if you attempt to invoke it. If you want to use a command<br />
that has been added after you have logged in, give the command<br />
rehash<br />
to the C shell. rehash causes the shell to recompute its internal table of command<br />
locations, so that it will find the newly added command. Note that rehashing is not<br />
necessary for commands added to the current directory. Since the C shell has to look in<br />
the current directory on each command anyway, placing it at the end of the path<br />
specification usually works best and reduces overhead.<br />
Other useful built-in variables are home, which shows your home directory, and<br />
ignoreeof, which can be set in your .login file to tell the C shell not to exit when it<br />
receives an end-of-file from a terminal. The variable ignoreeof is one of several<br />
variables with values that the C shell does not care about; the C shell is only concerned<br />
with whether these variables are set or unset. Thus, to set ignoreeof you simply type<br />
set ignoreeof<br />
and to unset it type<br />
unset ignoreeof<br />
Some other useful built-in C shell variables are noclobber and mail. The syntax<br />
> filename<br />
which redirects the standard output of a command just as in the regular shell,<br />
overwrites and destroys the previous contents of the named file. In this way, you may<br />
accidentally overwrite a valuable file. If you prefer that the C shell not overwrite files<br />
in this way, type<br />
set noclobber<br />
8-3