1 '\" te 2 .\" Copyright (c) 1982-2007 AT&T Knowledge Ventures 3 .\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt 4 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. 5 .TH KSH93 1 "Jun 27, 2018" 6 .SH NAME 7 ksh93, rksh93 \- Korn Shell, a standard and restricted command and programming 8 language 9 .SH SYNOPSIS 10 .LP 11 .nf 12 \fBksh93\fR [\fB\(+-abcefhikmnoprstuvxBCD\fR] [\fB-R\fR \fIfile\fR] [ \fB\(+-o\fR \fIoption\fR] ... 13 [-] [\fIarg\fR ...] 14 .fi 15 16 .LP 17 .nf 18 \fBrksh93\fR [\fB\(+-abcefhikmnoprstuvxBCD\fR] [\fB-R\fR \fIfile\fR] [\fB\(+-o\fR \fIoption\fR] ... 19 [-] [\fIarg\fR ...] 20 .fi 21 22 .SH DESCRIPTION 23 .LP 24 \fBksh93\fR is a command and programming language that executes commands read 25 from a terminal or a file. \fBrksh93\fR is a restricted version of the command 26 interpreter \fBksh93\fR. \fBrksh93\fR is used to set up login names and 27 execution environments whose capabilities are more controlled than those of the 28 standard shell. 29 .sp 30 .LP 31 See \fBInvocation\fR for the meaning of arguments to the shell. 32 .SS "Definitions" 33 .LP 34 A \fImetacharacter\fR is defined as one of the following characters: 35 .sp 36 .in +2 37 .nf 38 ; & ( ) | < > NEWLINE SPACE TAB 39 .fi 40 .in -2 41 .sp 42 43 .sp 44 .LP 45 A \fIblank\fR is a \fBTAB\fR or a \fBSPACE\fR. 46 .sp 47 .LP 48 An \fIidentifier\fR is a sequence of letters, digits, or underscores starting 49 with a letter or underscore. Identifiers are used as components of \fIvariable 50 names\fR. 51 .sp 52 .LP 53 A \fIvname\fR is a sequence of one or more identifiers separated by a period 54 (\fB\&.\fR) and optionally preceded by a period (\fB\&.\fR). \fIvnames\fR are 55 used as function and variable names. 56 .sp 57 .LP 58 A \fIword\fR is a sequence of \fIcharacters\fR from the character set defined 59 by the current locale, excluding non-quoted \fImetacharacters\fR. 60 .sp 61 .LP 62 A \fIcommand\fR is a sequence of characters in the syntax of the shell 63 language. The shell reads each command and carries out the desired action 64 either directly or by invoking separate utilities. A built-in command is a 65 command that is carried out by the shell itself without creating a separate 66 process. Some commands are built-in purely for convenience and are not 67 documented in this manual page. Built-ins that cause side effects in the shell 68 environment and built-ins that are found before performing a path search (see 69 \fBExecution\fR) are documented in this manual page. For historical reasons, 70 some of these built-ins behave differently than other built-ins and are called 71 special built-ins. 72 .SS "Commands" 73 .LP 74 A \fIsimple-command\fR is a list of variable assignments (see \fBVariable 75 Assignments\fR) or a sequence of \fIblank\fR-separated words which can be 76 preceded by a list of variable assignments. See the \fBEnvironment\fR section 77 of this manual page. 78 .sp 79 .LP 80 The first word specifies the name of the command to be executed. Except as 81 specified in this section, the remaining words are passed as arguments to the 82 invoked command. The command name is passed as argument 0. See \fBexec\fR(2). 83 The \fIvalue\fR of a simple-command is its exit status. If it terminates 84 normally, its value is \fB0\fR-\fB255\fR. If it terminates abnormally, its 85 value is \fB256+\fR\fIsignum\fR. The name of the signal corresponding to the 86 exit status can be obtained by way of the \fB-l\fR option of the kill built-in 87 utility. 88 .sp 89 .LP 90 A \fIpipeline\fR is a sequence of one or more commands separated by \fB|\fR. 91 The standard output of each command but the last is connected by a 92 \fBpipe\fR(2) to the standard input of the next command. Each command, except 93 possibly the last, is run as a separate process. The shell waits for the last 94 command to terminate. The exit status of a pipeline is the exit status of the 95 last command unless the \fBpipefail\fR option is enabled. Each pipeline can be 96 preceded by the reserved word\fB!\fR. This causes the exit status of the 97 pipeline to become \fB0\fR if the exit status of the last command is 98 \fBnon-zero\fR, and \fB1\fR if the exit status of the last command is \fB0\fR. 99 .sp 100 .LP 101 A \fIlist\fR is a sequence of one or more pipelines separated by \fB;, &, |&, 102 &&, or |\fR, and optionally terminated by \fB;, &,\fR or \fB|&\fR. Of these 103 five symbols, \fB;, &\fR, and \fB|&\fR have equal precedence, which is lower 104 than that of \fB&&\fR and \fB||\fR. The symbols \fB&&\fR and \fB||\fR also have 105 equal precedence. 106 .sp 107 .LP 108 A semicolon (\fB;\fR) causes sequential execution of the preceding pipeline. An 109 ampersand (\fB&\fR) causes asynchronous execution of the preceding pipeline, 110 that is, the shell does \fInot\fR wait for that pipeline to finish. The symbol 111 \fB|&\fR causes asynchronous execution of the preceding pipeline with a two-way 112 pipe established to the parent shell. The standard input and output of the 113 spawned pipeline can be written to and read from by the parent shell by 114 applying the redirection operators \fB<&\fR and \fB>&\fR with \fBarg p\fR to 115 commands and by using \fB-p\fR option of the built-in commands \fBread\fR and 116 \fBprint\fR. The symbol \fB&&\fR (\fB||\fR) causes the \fIlist\fR following it 117 to be executed only if the preceding pipeline returns a zero (\fBnon-zero\fR) 118 value. One or more NEWLINEs can appear in a \fIlist\fR instead of a semicolon, 119 to delimit a command. The first \fIitem\fR of the first \fIpipeline\fR of a 120 \fIlist\fR that is a simple command not beginning with a redirection, and not 121 occurring within a \fBwhile\fR, \fBuntil\fR, or \fBif\fR \fIlist\fR , can be 122 preceded by a semicolon. This semicolon is ignored unless the \fBshowme\fR 123 option is enabled as described with the \fBset\fR built-in. 124 .sp 125 .LP 126 A \fIcommand\fR is either a simple-command or one of commands in the following 127 list. Unless otherwise stated, the value returned by a command is that of the 128 last simple-command executed in the command. 129 .sp 130 .ne 2 131 .na 132 \fB\fBfor\fR \fIvname\fR \fB[ in\fR \fIword\fR \fB\&... ] ;do\fR \fIlist\fR 133 \fB;done\fR\fR 134 .ad 135 .sp .6 136 .RS 4n 137 Each time a \fBfor\fR command is executed, \fIvname\fR is set to the next 138 \fIword\fR taken from the \fBin\fR \fIword\fR list. If \fBin\fR \fIword ...\fR 139 is omitted, the \fBfor\fR command executes the \fBdo\fR \fIlist\fR once for 140 each positional parameter that is set starting from 1. Execution ends when 141 there are no more words in the list. See \fBParameter Expansion\fR. 142 .RE 143 144 .sp 145 .ne 2 146 .na 147 \fB\fB(( [\fR\fIexpr1\fR\fB] ; [\fR\fIexpr2\fR] ; [\fIexpr3\fR\fB] )) ;do\fR 148 \fIlist\fR \fB;done\fR\fR 149 .ad 150 .sp .6 151 .RS 4n 152 The arithmetic expression \fIexpr1\fR is evaluated first. The arithmetic 153 expression \fIexpr2\fR is repeatedly evaluated until it evaluates to \fBzero\fR 154 and when \fBnon-zero\fR, \fIlist\fR is executed and the arithmetic expression 155 \fIexpr3\fR evaluated. If any expression is omitted, then it behaves as if it 156 evaluated to \fB1\fR. See \fBArithmetic Evaluation\fR. 157 .RE 158 159 .sp 160 .ne 2 161 .na 162 \fB\fBselect\fR \fIvname\fR [ in \fIword\fR \fB\&... ] ;do\fR \fIlist\fR 163 \fB;done\fR\fR 164 .ad 165 .sp .6 166 .RS 4n 167 A \fBselect\fR command prints on standard error (file descriptor 2) the set of 168 \fIwords\fR, each preceded by a number. If \fBin\fR \fIword...\fR is omitted, 169 the positional parameters starting from \fB1\fR are used instead. See 170 \fBParameter Expansion\fR. The \fBPS3\fR prompt is printed and a line is read 171 from the standard input. If this line consists of the number of one of the 172 listed \fIword\fRs, then the value of the variable \fIvname\fR is set to the 173 \fIword\fR corresponding to this number. If this line is empty, the selection 174 list is printed again. Otherwise the value of the variable \fIvname\fR is set 175 to \fBnull\fR. The contents of the line read from standard input is saved in 176 the variable \fBREPLY\fR. The \fIlist\fR is executed for each selection until a 177 break or \fBEOF\fR is encountered. If the \fBREPLY\fR variable is set to 178 \fBnull\fR by the execution of \fIlist\fR, the selection list is printed before 179 displaying the \fBPS3\fR prompt for the next selection. 180 .RE 181 182 .sp 183 .ne 2 184 .na 185 \fB\fBcase\fR \fIword\fR \fBin [ [(]\fR \fIpattern\fR \fB[ |\fR \fIpattern\fR 186 \fB] ... )\fR \fIlist\fR \fB;; ] ... esac\fR\fR 187 .ad 188 .sp .6 189 .RS 4n 190 A \fBcase\fR command executes the \fIlist\fR associated with the first 191 \fIpattern\fR that matches \fIword\fR. The form of the patterns is the same as 192 that used for file name generation. See \fBFile Name Generation\fR. 193 .sp 194 The \fB;;\fR operator causes execution of \fBcase\fR to terminate. If \fB;&\fR 195 is used in place of \fB;;\fR the next subsequent list, if any, is executed. 196 .RE 197 198 .sp 199 .ne 2 200 .na 201 \fB\fBif\fR \fIlist\fR \fB;then\fR \fIlist\fR \fB[ ;elif\fR \fIlist\fR 202 \fB;then\fR \fIlist\fR ] \fB\&... [ ;else\fR \fIlist\fR \fB]\fR \fB;fi\fR\fR 203 .ad 204 .sp .6 205 .RS 4n 206 The \fIlist\fR following \fBif\fR is executed and, if it returns a \fBzero\fR 207 exit status, the \fIlist\fR following the first \fBthen\fR is executed. 208 Otherwise, the \fIlist\fR following \fBelif\fR is executed, and, if its value 209 is \fBzero\fR, the \fIlist\fR following the next \fBthen\fR is executed. 210 Failing each successive \fBelif\fR \fIlist\fR, the \fBelse\fR \fIlist\fR is 211 executed. If the \fBif\fR \fIlist\fR has \fBnon-zero\fR exit status and there 212 is no \fBelse\fR \fIlist\fR, then the \fBif\fR command returns a \fBzero\fR 213 exit status. 214 .RE 215 216 .sp 217 .ne 2 218 .na 219 \fB\fBwhile\fR \fIlist\fR \fB;do\fR \fIlist\fR \fB;done\fR\fR 220 .ad 221 .br 222 .na 223 \fBuntil \fIlist\fR \fB;do\fR \fIlist\fR \fB;done\fR\fR 224 .ad 225 .sp .6 226 .RS 4n 227 A \fBwhile\fR command repeatedly executes the while \fIlist\fR and, if the exit 228 status of the last command in the list is zero, executes the \fBdo\fR 229 \fIlist\fR, otherwise the loop terminates. If no commands in the \fBdo\fR 230 \fIlist\fR are executed, then the \fBwhile\fR command returns a \fBzero\fR exit 231 status, \fBuntil\fR can be used in place of \fBwhile\fR to negate the loop 232 termination test. 233 .RE 234 235 .sp 236 .ne 2 237 .na 238 \fB\fB((\fR\fIexpression\fR\fB))\fR\fR 239 .ad 240 .sp .6 241 .RS 4n 242 The \fIexpression\fR is evaluated using the rules for arithmetic evaluation 243 described in this manual page. If the value of the arithmetic expression is 244 \fBnon-zero\fR, the exit status is \fB0\fR. Otherwise the exit status is 245 \fB1\fR. 246 .RE 247 248 .sp 249 .ne 2 250 .na 251 \fB\fB(\fR\fIlist\fR\fB;)\fR\fR 252 .ad 253 .sp .6 254 .RS 4n 255 Execute list in a separate environment. If two adjacent open parentheses are 256 needed for nesting, a SPACE must be inserted to avoid evaluation as an 257 arithmetic command as described in this section. 258 .sp 259 \fIlist\fR is simply executed. Unlike the metacharacters, \fB(\fR and \fB)\fR, 260 \fB{\fR and \fB}\fR are \fIreserved words\fR and must occur at the beginning of 261 a line or after a \fB;\fR to be recognized. 262 .RE 263 264 .sp 265 .ne 2 266 .na 267 \fB\fB[[\fR \fIexpression\fR \fB]]\fR\fR 268 .ad 269 .sp .6 270 .RS 4n 271 Evaluates \fIexpression\fR and returns a \fBzero\fR exit status when 272 \fIexpression\fR is true. See \fBConditional Expressions\fR for a description 273 of \fIexpression\fR. 274 .RE 275 276 .sp 277 .ne 2 278 .na 279 \fB\fBfunction\fR \fIvarname\fR \fB{\fR \fIlist\fR \fB;}\fR\fR 280 .ad 281 .br 282 .na 283 \fB\fIvarname\fR \fB() {\fR \fIlist\fR \fB;}\fR\fR 284 .ad 285 .sp .6 286 .RS 4n 287 Define a function which is referenced by \fIvarname\fR. A function whose 288 \fIvarname\fR contains a \fB\&.\fR is called a discipline function and the 289 portion of the \fIvarname\fR preceding the last \fB\&.\fR must refer to an 290 existing variable. 291 .sp 292 The body of the function is the \fIlist\fR of commands between \fB{\fR and 293 \fB}\fR. A function defined with the function \fIvarname\fR syntax can also be 294 used as an argument to the \fB\&.\fR special built-in command to get the 295 equivalent behavior as if the \fIvarname\fR\fB()\fR syntax were used to define 296 it. See \fBFunctions\fR. 297 .RE 298 299 .sp 300 .ne 2 301 .na 302 \fB\fBtime [\fR \fIpipeline\fR \fB]\fR\fR 303 .ad 304 .sp .6 305 .RS 4n 306 If \fIpipeline\fR is omitted, the user and system time for the current shell 307 and completed child processes is printed on standard error. Otherwise, 308 \fIpipeline\fR is executed and the elapsed time as well as the user and system 309 time are printed on standard error. The \fBTIMEFORMAT\fR variable can be set to 310 a format string that specifies how the timing information should be displayed. 311 See \fBShell Variables\fR for a description of the \fBTIMEFORMAT\fR variable. 312 .RE 313 314 .sp 315 .LP 316 The following reserved words are recognized as reserved only when they are the 317 first word of a command and are not quoted: 318 .br 319 .in +2 320 \fBcase\fR 321 .in -2 322 .br 323 .in +2 324 \fBdo\fR 325 .in -2 326 .br 327 .in +2 328 \fBdone\fR 329 .in -2 330 .br 331 .in +2 332 \fBelse\fR 333 .in -2 334 .br 335 .in +2 336 \fBelif\fR 337 .in -2 338 .br 339 .in +2 340 \fBesac\fR 341 .in -2 342 .br 343 .in +2 344 \fBfor\fR 345 .in -2 346 .br 347 .in +2 348 \fBfi\fR 349 .in -2 350 .br 351 .in +2 352 \fBfunction\fR 353 .in -2 354 .br 355 .in +2 356 \fBif\fR 357 .in -2 358 .br 359 .in +2 360 \fBselect\fR 361 .in -2 362 .br 363 .in +2 364 \fBthen\fR 365 .in -2 366 .br 367 .in +2 368 \fBtime\fR 369 .in -2 370 .br 371 .in +2 372 \fBuntil\fR 373 .in -2 374 .br 375 .in +2 376 \fBwhile\fR 377 .in -2 378 .br 379 .in +2 380 \fB{ }\fR 381 .in -2 382 .br 383 .in +2 384 \fB[[ ]]\fR 385 .in -2 386 .br 387 .in +2 388 \fB!\fR 389 .in -2 390 .SS "Variable Assignments" 391 .LP 392 One or more variable assignments can start a simple command or can be arguments 393 to the \fBtypeset\fR, \fBexport\fR, or \fBreadonly\fR special built-in 394 commands. The syntax for an \fIassignment\fR is of the form: 395 .sp 396 .ne 2 397 .na 398 \fB\fIvarname\fR\fB=\fR\fIword\fR\fR 399 .ad 400 .br 401 .na 402 \fB\fIvarname\fR\fB[\fR\fIword\fR\fB]=\fR\fIword\fR\fR 403 .ad 404 .sp .6 405 .RS 4n 406 No space is permitted between \fIvarname\fR and the \fB=\fR or between \fB=\fR 407 and \fIword\fR. 408 .RE 409 410 .sp 411 .ne 2 412 .na 413 \fB\fIvarname\fR\fB=(\fR\fIassignlist\fR\fB)\fR\fR 414 .ad 415 .sp .6 416 .RS 4n 417 No space is permitted between \fIvarname\fR and the \fB=\fR. An 418 \fIassignlist\fR can be one of the following: 419 .sp 420 .ne 2 421 .na 422 \fB\fIword ...\fR\fR 423 .ad 424 .sp .6 425 .RS 4n 426 Indexed array assignment. 427 .RE 428 429 .sp 430 .ne 2 431 .na 432 \fB\fB[\fR\fIword\fR\fB]=\fR\fIword ...\fR\fR 433 .ad 434 .sp .6 435 .RS 4n 436 Associative array assignment. If prefixed by \fBtypeset\fR \fB-a\fR, creates an 437 indexed array instead. 438 .RE 439 440 .sp 441 .ne 2 442 .na 443 \fB\fIassignment ...\fR\fR 444 .ad 445 .sp .6 446 .RS 4n 447 Compound variable assignment. This creates a compound variable \fIvarname\fR 448 with sub-variables of the form \fIvarname.name\fR, where \fIname\fR is the name 449 portion of assignment. The value of \fIvarname\fR contains all the assignment 450 elements. Additional assignments made to sub-variables of \fIvarname\fR are 451 also displayed as part of the value of \fIvarname\fR. If no \fIassignment\fRs 452 are specified, \fIvarname\fR is a compound variable allowing subsequence child 453 elements to be defined. 454 .RE 455 456 .sp 457 .ne 2 458 .na 459 \fB\fBtypeset [\fR\fIoptions\fR] \fIassignment\fR \fB\&...\fR\fR 460 .ad 461 .sp .6 462 .RS 4n 463 Nested variable assignment. Multiple assignments can be specified by separating 464 each of them with a \fB;\fR. The previous value is unset before the assignment. 465 .RE 466 467 In addition, a \fB+=\fR can be used in place of the \fB=\fR to signify adding 468 to or appending to the previous value. When \fB+=\fR is applied to an 469 arithmetic type, \fIword\fR is evaluated as an arithmetic expression and added 470 to the current value. When applied to a string variable, the value defined by 471 \fIword\fR is appended to the value. For compound assignments, the previous 472 value is not unset and the new values are appended to the current ones provided 473 that the types are compatible. 474 .RE 475 476 .SS "Comments" 477 .LP 478 A word beginning with \fB#\fR causes that word and all the following characters 479 up to a NEWLINE to be commented, or ignored. 480 .SS "Aliasing" 481 .LP 482 The first word of each command is replaced by the text of an alias if an alias 483 for this word has been defined. An alias name consists of any number of 484 characters excluding metacharacters, quoting characters, file expansion 485 characters, parameter expansion characters, command substitution characters, 486 and \fB=\fR. The replacement string can contain any valid shell script 487 including the metacharacters listed in the \fBCommands\fR section. The first 488 word of each command in the replaced text, other than any that are in the 489 process of being replaced, are tested for aliases. If the last character of the 490 alias value is a BLANK then the word following the alias is also checked for 491 alias substitution. 492 .sp 493 .LP 494 Aliases can be used to redefine built-in commands but cannot be used to 495 redefine the reserved words listed in the \fBCommands\fR section. Aliases can 496 be created and listed with the alias command and can be removed with the 497 \fBunalias\fR command. 498 .sp 499 .LP 500 Aliasing is performed when scripts are read, not while they are executed. For 501 an alias to take effect, the \fBalias\fR definition command has to be executed 502 before the command which references the alias is read. The following aliases 503 are compiled into the shell but can be unset or redefined: 504 .sp 505 .in +2 506 .nf 507 autoload='typeset -fu' 508 command='command ' 509 fc=hist 510 float='typeset -lE' 511 functions='typeset -f' 512 hash='alias -t --' 513 history='hist -l' 514 integer='typeset -li' 515 nameref='typeset -n' 516 nohup='nohup ' 517 r='hist -s' 518 redirect='command exec' 519 source='command .' 520 stop='kill -s STOP' 521 suspend='kill -s STOP $$' 522 times='{ { time;} 2>&1;}' 523 type='whence -v' 524 .fi 525 .in -2 526 .sp 527 528 .SS "Tilde Substitution" 529 .LP 530 After alias substitution is performed, each word is checked to see if it begins 531 with an unquoted tilde (\fB~\fR). For tilde substitution, \fIword\fR also 532 refers to the \fIword\fR portion of parameter expansion. See \fBParameter 533 Expansion\fR. 534 .sp 535 .LP 536 If it does, the word up to a \fB/\fR is checked to see if it matches a user 537 name in the password database. If a match is found, the \fB~\fR and the matched 538 login name are replaced by the login directory of the matched user. If no match 539 is found, the original text is left unchanged. A \fB~\fR by itself, or in front 540 of a \fB/\fR, is replaced by \fB$HOME\fR. A \fB~\fR followed by a \fB+\fR or 541 \fB-\fR is replaced by the value of \fB$PWD\fR and \fB$OLDPWD\fR respectively. 542 .sp 543 .LP 544 In addition, when expanding a \fIvariable assignment\fR, tilde substitution is 545 attempted when the value of the assignment begins with a \fB~\fR, and when a 546 \fB~\fR appears after a colon (\fB:\fR). The \fB:\fR also terminates a \fB~\fR 547 login name. 548 .SS "Command Substitution" 549 .LP 550 The standard output from a command enclosed in parentheses preceded by a dollar 551 sign (\fB$\fR) or a pair of grave accents (\fB``\fR) can be used as part or all 552 of a word. Trailing NEWLINEs are removed. In the second (obsolete) form, the 553 string between the quotes is processed for special quoting characters before 554 the command is executed. See \fBQuoting\fR. 555 .sp 556 .LP 557 The command substitution \fB$(cat file)\fR can be replaced by the equivalent 558 but faster \fB$(<file)\fR. The command substitution \fB$(\fR\fIn\fR\fB<#)\fR 559 expands to the current byte offset for file descriptor \fIn\fR. 560 .SS "Arithmetic Substitution" 561 .LP 562 An arithmetic expression enclosed in double parentheses preceded by a dollar 563 sign ( \fB$((\fR\fIarithmetic_expression\fR\fB))\fR) is replaced by the value 564 of the arithmetic expression within the double parentheses. 565 .SS "Process Substitution" 566 .LP 567 Process substitution is only available on versions of the UNIX operating system 568 that support the \fB/dev/fd\fR directory for naming open files. 569 .sp 570 .LP 571 Each command argument of the form \fB<(\fR\fIlist\fR\fB)\fR or 572 \fB>(\fR\fIlist\fR\fB)\fR runs process \fIlist\fR asynchronously connected to 573 some file in \fB/dev/fd\fR. The name of this file becomes the argument to the 574 command. If the form with \fB>\fR is selected then writing on this file 575 provides input for \fIlist\fR. If \fB<\fR is used, then the file passed as an 576 argument contains the output of the \fIlist\fR process. 577 .sp 578 .LP 579 For example, 580 .sp 581 .in +2 582 .nf 583 paste <(cut -f1 \fIfile1\fR) <(cut -f3 \fIfile2\fR) | tee \e 584 >(\fIprocess1\fR) >(\fIprocess2\fR) 585 .fi 586 .in -2 587 .sp 588 589 .sp 590 .LP 591 \fBcut\fRs fields 1 and 3 from the files \fIfile1\fR and \fIfile2\fR 592 respectively, \fBpaste\fRs the results together, and sends it to the processes 593 \fIprocess1\fR and \fIprocess2\fR. It also displays the results to the standard 594 output. The file, which is passed as an argument to the command, is a UNIX 595 \fBpipe\fR(2). Programs that expect to \fBlseek\fR(2) on the file do not work. 596 .SS "Parameter Expansion" 597 .LP 598 A parameter is a variable, one or more digits, or any of the characters 599 \fB*\fR, \fB@\fR, \fB#\fR, \fB?\fR, \fB-\fR, \fB$\fR, and \fB!\fR. A variable 600 is denoted by a \fIvname\fR. To create a variable whose \fIvname\fR contains a 601 \fB\&.\fR, a variable whose \fBvname\fR consists of everything before the 602 last . must already exist. A variable has a value and zero or more attributes. 603 Variables can be assigned values and attributes by using the \fBtypeset\fR 604 special built-in command. The attributes supported by the shell are described 605 later with the \fBtypeset\fR special built-in command. Exported variables pass 606 values and attributes to the environment. 607 .sp 608 .LP 609 The shell supports both indexed and associative arrays. An element of an array 610 variable is referenced by a subscript. A subscript for an indexed array is 611 denoted by an arithmetic expression, (see \fBArithmetic Evaluation\fR), between 612 a \fB[\fR and a \fB]\fR. Use \fBset -A\fR \fIvname value ...\fR to assign 613 values to an indexed array. The value of all subscripts must be in the range of 614 \fB0\fR through \fB1,048,575\fR. Indexed arrays do not need to be declared. Any 615 reference to a variable with a valid subscript is legal and an array is created 616 if necessary. 617 .sp 618 .LP 619 An associative array is created with the \fB-A\fR option to \fBtypeset\fR. A 620 subscript for an associative array is denoted by a string enclosed between 621 \fB[\fR and \fB]\fR. 622 .sp 623 .LP 624 Referencing any array without a subscript is equivalent to referencing the 625 array with subscript \fB0\fR. 626 .sp 627 .LP 628 The value of a variable can be assigned by: 629 .sp 630 .in +2 631 .nf 632 \fIvname\fR=\fIvalue\fR [\fIvname\fR=\fIvalue\fR] ... 633 .fi 634 .in -2 635 .sp 636 637 .sp 638 .LP 639 or 640 .sp 641 .in +2 642 .nf 643 \fIvname\fR[\fIsubscript\fR]=\fIvalue\fR [\fIvname\fR[\fIsubscript\fR]=\fIvalue\fR] ... 644 .fi 645 .in -2 646 .sp 647 648 .sp 649 .LP 650 No space is allowed before or after the \fB=\fR. A \fInameref\fR is a variable 651 that is a reference to another variable. A \fInameref\fR is created with the 652 \fB-n\fR attribute of \fBtypeset\fR. The value of the variable at the time of 653 the \fBtypeset\fR command becomes the variable that is referenced whenever the 654 \fInameref\fR variable is used. The name of a \fInameref\fR cannot contain a 655 dot (\fI\&.\fR). When a variable or function name contains a \fB\&.,\fR and the 656 portion of the name up to the first \fB\&.\fR matches the name of a 657 \fInameref\fR, the variable referred to is obtained by replacing the 658 \fInameref\fR portion with the name of the variable referenced by the 659 \fInameref\fR. If a \fInameref\fR is used as the index of a \fBfor\fR loop, a 660 name reference is established for each item in the list. A \fInameref\fR 661 provides a convenient way to refer to the variable inside a function whose name 662 is passed as an argument to a function. For example, if the name of a variable 663 is passed as the first argument to a function, the command 664 .sp 665 .in +2 666 .nf 667 typeset -n var=$1 668 .fi 669 .in -2 670 .sp 671 672 .sp 673 .LP 674 inside the function causes references and assignments to \fIvar\fR to be 675 references and assignments to the variable whose name has been passed to the 676 function. If either of the floating point attributes, \fB-E\fR, or \fB-F\fR, or 677 the integer attribute, \fB-i\fR, is set for \fIvname\fR, then the \fIvalue\fR 678 is subject to arithmetic evaluation as described in this manual page. 679 Positional parameters, parameters denoted by a number, can be assigned values 680 with the \fBset\fR special built-in command. Parameter \fB$0\fR is set from 681 argument zero when the shell is invoked. The character \fB$\fR is used to 682 introduce substitutable parameters. 683 .sp 684 .ne 2 685 .na 686 \fB\fB${\fR\fIparameter\fR\fB}\fR\fR 687 .ad 688 .sp .6 689 .RS 4n 690 The shell reads all the characters from \fB${\fR to the matching \fB}\fR as 691 part of the same word even if it contains braces or metacharacters. The value, 692 if any, of the parameter is substituted. The braces are required when 693 \fIparameter\fR is followed by a letter, digit, or underscore that is not to be 694 interpreted as part of its name, when the variable name contains a \fB\&.\fR, 695 or when a variable is subscripted. If \fIparameter\fR is one or more digits 696 then it is a positional parameter. A positional parameter of more than one 697 digit must be enclosed in braces. If \fIparameter\fR is \fB*\fR or \fB@\fR, 698 then all the positional parameters, starting with \fB$1\fR, are substituted and 699 separated by a field separator character. If an array \fIvname\fR with 700 subscript \fB*\fR or \fB@\fR is used, then the value for each of the elements 701 is substituted, separated by the first character of the value of \fBIFS\fR. 702 .RE 703 704 .sp 705 .ne 2 706 .na 707 \fB\fB${#\fR\fIparameter\fR\fB}\fR\fR 708 .ad 709 .sp .6 710 .RS 4n 711 If \fIparameter\fR is \fB*\fR or \fB@\fR, the number of positional parameters 712 is substituted. Otherwise, the length of the value of the \fIparameter\fR is 713 substituted. 714 .RE 715 716 .sp 717 .ne 2 718 .na 719 \fB\fB${#\fR\fIvname\fR\fB[*]}\fR\fR 720 .ad 721 .br 722 .na 723 \fB\fB${#\fR\fIvname\fR\fB[@]}\fR\fR 724 .ad 725 .sp .6 726 .RS 4n 727 The number of elements in the array \fIvname\fR is substituted. 728 .RE 729 730 .sp 731 .ne 2 732 .na 733 \fB\fB${!\fR\fIvname\fR\fB}\fR\fR 734 .ad 735 .sp .6 736 .RS 4n 737 Expands to the name of the variable referred to by \fIvname\fR. This is 738 \fIvname\fR except when \fIvname\fR is a name reference. 739 .RE 740 741 .sp 742 .ne 2 743 .na 744 \fB\fB${!\fR\fIvname\fR\fB[\fR\fIsubscript\fR\fB]}\fR\fR 745 .ad 746 .sp .6 747 .RS 4n 748 Expands to name of the subscript unless \fIsubscript\fR is \fB*\fR or \fB@\fR. 749 When \fIsubscript\fR is \fB*\fR, the list of array subscripts for \fIvname\fR 750 is generated. For a variable that is not an array, the value is \fB0\fR if the 751 variable is set. Otherwise it is \fBnull\fR. When \fIsubscript\fR is \fB@\fR, 752 it is the same as \fB$ {\fR\fIvname\fR\fB[\fR\fI*\fR\fB]}\fR, except that when 753 used in double quotes, each array subscript yields a separate argument. 754 .RE 755 756 .sp 757 .ne 2 758 .na 759 \fB\fB${!\fR\fIprefix\fR\fB*}\fR\fR 760 .ad 761 .sp .6 762 .RS 4n 763 Expands to the names of the variables whose names begin with \fIprefix\fR. 764 .RE 765 766 .sp 767 .ne 2 768 .na 769 \fB\fB${\fR\fIparameter\fR\fB:-\fR\fIword\fR\fB}\fR\fR 770 .ad 771 .sp .6 772 .RS 4n 773 If \fIparameter\fR is set and is non-null then substitute its value. Otherwise 774 substitute \fIword\fR. 775 .sp 776 \fIword\fR is not evaluated unless it is to be used as the substituted string. 777 .sp 778 In the following example, \fBpwd\fR is executed only if \fBd\fR is not set or 779 is NULL: 780 .sp 781 .in +2 782 .nf 783 print ${d:-$(pwd)} 784 .fi 785 .in -2 786 .sp 787 788 If the colon (\fB:\fR ) is omitted from the expression, the shell only checks 789 whether \fIparameter\fR is set or not. 790 .RE 791 792 .sp 793 .ne 2 794 .na 795 \fB\fB${\fR\fIparameter\fR\fB:=\fR\fIword\fR\fB}\fR\fR 796 .ad 797 .sp .6 798 .RS 4n 799 If \fIparameter\fR is not set or is \fBnull\fR, set it to \fIword\fR. The value 800 of the parameter is then substituted. Positional parameters cannot be assigned 801 to in this way. 802 .sp 803 \fIword\fR is not evaluated unless it is to be used as the substituted string. 804 .sp 805 In the following example, \fBpwd\fR is executed only if \fBd\fR is not set or 806 is NULL: 807 .sp 808 .in +2 809 .nf 810 print ${d:-$(pwd)} 811 .fi 812 .in -2 813 .sp 814 815 If the colon (\fB:\fR) is omitted from the expression, the shell only checks 816 whether \fIparameter\fR is set or not. 817 .RE 818 819 .sp 820 .ne 2 821 .na 822 \fB\fB${\fR\fIparameter\fR\fB:?\fR\fIword\fR\fB}\fR\fR 823 .ad 824 .sp .6 825 .RS 4n 826 If \fIparameter\fR is set and is non-null, substitute its value. Otherwise, 827 print \fIword\fR and exit from the shell , if the shell is not interactive. If 828 \fIword\fR is omitted then a standard message is printed. 829 .sp 830 \fIword\fR is not evaluated unless it is to be used as the substituted string. 831 .sp 832 In the following example, \fBpwd\fR is executed only if \fBd\fR is not set or 833 is NULL: 834 .sp 835 .in +2 836 .nf 837 print ${d:-$(pwd)} 838 .fi 839 .in -2 840 .sp 841 842 If the colon (\fB:\fR ) is omitted from the expression, the shell only checks 843 whether \fIparameter\fR is set or not. 844 .RE 845 846 .sp 847 .ne 2 848 .na 849 \fB\fB${\fR\fIparameter\fR\fB:+\fR\fIword\fR\fB}\fR\fR 850 .ad 851 .sp .6 852 .RS 4n 853 If \fIparameter\fR is set and is non-null, substitute \fIword\fR. Otherwise 854 substitute nothing. 855 .sp 856 \fIword\fR is not evaluated unless it is to be used as the substituted string. 857 .sp 858 In the following example, \fBpwd\fR is executed only if \fBd\fR is not set or 859 is NULL: 860 .sp 861 .in +2 862 .nf 863 print ${d:-$(pwd)} 864 .fi 865 .in -2 866 .sp 867 868 If the colon (\fB:\fR) is omitted from the expression, the shell only checks 869 whether \fIparameter\fR is set or not. 870 .RE 871 872 .sp 873 .ne 2 874 .na 875 \fB\fB${\fR\fIparameter\fR\fB:\fR\fIoffset\fR:\fIlength\fR}\fR 876 .ad 877 .br 878 .na 879 \fB\fB${\fR\fIparameter\fR\fB:\fR\fIoffset\fR\fB}\fR\fR 880 .ad 881 .sp .6 882 .RS 4n 883 Expands to the portion of the value of \fIparameter\fR starting at the 884 character (counting from \fB0\fR) determined by expanding offset as an 885 arithmetic expression and consisting of the number of characters determined by 886 the arithmetic expression defined by \fIlength\fR. 887 .sp 888 In the second form, the remainder of the value is used. A negative offset 889 counts backwards from the end of \fIparameter\fR. 890 .sp 891 One or more BLANKs is required in front of a minus sign to prevent the shell 892 from interpreting the operator as \fB:-\fR. If parameter is \fB*\fR or \fB@\fR, 893 or is an array name indexed by \fB*\fR or \fB@\fR, then \fIoffset\fR and 894 \fIlength\fR refer to the array index and number of elements respectively. A 895 negative \fIoffset\fR is taken relative to one greater than the highest 896 subscript for indexed arrays. The order for associative arrays is unspecified. 897 .RE 898 899 .sp 900 .ne 2 901 .na 902 \fB\fB${\fR\fIparameter\fR\fB#\fR\fIpattern\fR\fB}\fR\fR 903 .ad 904 .br 905 .na 906 \fB\fB${\fR\fIparameter\fR\fB##\fR\fIpattern\fR\fB}\fR\fR 907 .ad 908 .sp .6 909 .RS 4n 910 If the shell \fIpattern\fR matches the beginning of the value of 911 \fIparameter\fR, then the value of this expansion is the value of the 912 \fIparameter\fR with the matched portion deleted. Otherwise the value of this 913 \fIparameter\fR is substituted. In the first form the smallest matching 914 \fIpattern\fR is deleted and in the second form the largest matching 915 \fIpattern\fR is deleted. When \fIparameter\fR is \fB@\fR, \fB*\fR, or an array 916 variable with subscript \fB@\fR or \fB*\fR, the substring operation is applied 917 to each element in turn. 918 .RE 919 920 .sp 921 .ne 2 922 .na 923 \fB\fB${\fR\fIparameter\fR\fB%\fR\fIpattern\fR\fB}\fR\fR 924 .ad 925 .br 926 .na 927 \fB\fB${\fR\fIparameter\fR\fB%%\fR\fIpattern\fR\fB}\fR\fR 928 .ad 929 .sp .6 930 .RS 4n 931 If the shell \fIpattern\fR matches the end of the value of \fIparameter\fR, 932 then the value of this expansion is the value of the parameter with the matched 933 part deleted. Otherwise substitute the value of \fIparameter\fR. In the first 934 form the smallest matching pattern is deleted, and in the second form the 935 largest matching pattern is deleted. When parameter is \fB@\fR, \fB*\fR, or an 936 array variable with subscript \fB@\fR or \fB*\fR, the substring operation is 937 applied to each element in turn. 938 .RE 939 940 .sp 941 .ne 2 942 .na 943 \fB\fB${\fR\fIparameter\fR\fB/\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR\fR 944 .ad 945 .br 946 .na 947 \fB\fB${\fR\fIparameter\fR\fB//\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR\fR 948 .ad 949 .br 950 .na 951 \fB\fB${\fR\fIparameter\fR\fB/#\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR\fR 952 .ad 953 .br 954 .na 955 \fB\fB${\fR\fIparameter\fR\fB/%\fR\fIpattern\fR\fB/\fR\fIstring\fR\fB}\fR\fR 956 .ad 957 .sp .6 958 .RS 4n 959 Expands \fIparameter\fR and replaces the longest match of \fIpattern\fR with 960 the specified \fIstring\fR. Each occurrence of \fB\e\fR\fIn\fR in \fIstring\fR 961 is replaced by the portion of \fIparameter\fR that matches the \fIn\fR\fBth\fR 962 sub-pattern. 963 .sp 964 When \fIstring\fR is null, the \fIpattern\fR is deleted and the \fB/\fR in 965 front of string can be omitted. When \fIparameter\fR is \fB@\fR, \fB*\fR, or an 966 array variable with subscript \fB@\fR or \fB*\fR, the substitution operation is 967 applied to each element in turn. In this case, the \fIstring\fR portion of 968 \fIword\fR is re-evaluated for each element. 969 .sp 970 In the first form, only the first occurrence of \fIpattern\fR is replaced. 971 .sp 972 In the second form, each match for \fIpattern\fR is replaced by the specified 973 \fIstring\fR. 974 .sp 975 The third form restricts the pattern match to the beginning of the 976 \fIstring\fR. 977 .sp 978 The fourth form restricts the pattern match to the end of the \fIstring\fR. 979 .RE 980 981 .sp 982 .LP 983 The following parameters are automatically set by the shell: 984 .sp 985 .ne 2 986 .na 987 \fB\fB#\fR\fR 988 .ad 989 .RS 19n 990 The number of positional parameters in decimal. 991 .RE 992 993 .sp 994 .ne 2 995 .na 996 \fB\fB-\fR\fR 997 .ad 998 .RS 19n 999 Options supplied to the shell on invocation or by the \fBset\fR command. 1000 .RE 1001 1002 .sp 1003 .ne 2 1004 .na 1005 \fB\fB?\fR\fR 1006 .ad 1007 .RS 19n 1008 The decimal value returned by the last executed command. 1009 .RE 1010 1011 .sp 1012 .ne 2 1013 .na 1014 \fB\fB$\fR\fR 1015 .ad 1016 .RS 19n 1017 The process number of this shell. 1018 .RE 1019 1020 .sp 1021 .ne 2 1022 .na 1023 \fB\fB_\fR\fR 1024 .ad 1025 .RS 19n 1026 Initially, the value of \fB_\fR is the absolute pathname of the shell or script 1027 being executed as passed in the environment. It is subsequently assigned the 1028 last argument of the previous command. 1029 .sp 1030 This parameter is not set for commands which are asynchronous. This parameter 1031 is also used to hold the name of the matching \fBMAIL\fR file when checking for 1032 mail. 1033 .RE 1034 1035 .sp 1036 .ne 2 1037 .na 1038 \fB\fB!\fR\fR 1039 .ad 1040 .RS 19n 1041 The process number of the last background command invoked or the most recent 1042 job put in the background with the \fBbg\fR built-in command. 1043 .RE 1044 1045 .sp 1046 .ne 2 1047 .na 1048 \fB\fB\&.sh.command\fR\fR 1049 .ad 1050 .RS 19n 1051 When processing a \fBDEBUG\fR trap, this variable contains the current command 1052 line that is about to run. 1053 .RE 1054 1055 .sp 1056 .ne 2 1057 .na 1058 \fB\fB\&.sh.edchar\fR\fR 1059 .ad 1060 .RS 19n 1061 This variable contains the value of the keyboard character (or sequence of 1062 characters if the first character is an ESC, \fBASCII 033\fR) that has been 1063 entered when processing a \fBKEYBD\fR trap. If the value is changed as part of 1064 the trap action, then the new value replaces the key (or key sequence) that 1065 caused the trap. See the \fBKey Bindings\fR section of this manual page. 1066 .RE 1067 1068 .sp 1069 .ne 2 1070 .na 1071 \fB\fB\&.sh.edcol\fR\fR 1072 .ad 1073 .RS 19n 1074 The character position of the cursor at the time of the most recent \fBKEYBD\fR 1075 trap. 1076 .RE 1077 1078 .sp 1079 .ne 2 1080 .na 1081 \fB\fB\&.sh.edmode\fR\fR 1082 .ad 1083 .RS 19n 1084 The value is set to ESC when processing a \fBKEYBD\fR trap while in \fBvi\fR 1085 insert mode. Otherwise, \fB\&.sh.edmode\fR is null when processing a 1086 \fBKEYBD\fR trap. See the \fBvi Editing Mode\fR section of this manual page. 1087 .RE 1088 1089 .sp 1090 .ne 2 1091 .na 1092 \fB\fB\&.sh.edtext\fR\fR 1093 .ad 1094 .RS 19n 1095 The characters in the input buffer at the time of the most recent \fBKEYBD\fR 1096 trap. The value is null when not processing a \fBKEYBD\fR trap. 1097 .RE 1098 1099 .sp 1100 .ne 2 1101 .na 1102 \fB\fB\&.sh.file\fR\fR 1103 .ad 1104 .RS 19n 1105 The pathname of the file than contains the current command. 1106 .RE 1107 1108 .sp 1109 .ne 2 1110 .na 1111 \fB\fB\&.sh.fun\fR\fR 1112 .ad 1113 .RS 19n 1114 The name of the current function that is being executed. 1115 .RE 1116 1117 .sp 1118 .ne 2 1119 .na 1120 \fB\fB\&.sh.match\fR\fR 1121 .ad 1122 .RS 19n 1123 An indexed array which stores the most recent match and sub-pattern matches 1124 after conditional pattern matches that match and after variables expansions 1125 using the operators \fB#\fR, \fB%\fR, or \fB/\fR. The \fB0\fRth element stores 1126 the complete match and the \fIi\fRth element stores the \fIi\fRth sub-match. 1127 The \fB\&.sh.match\fR variable is unset when the variable that has expanded is 1128 assigned a new value. 1129 .RE 1130 1131 .sp 1132 .ne 2 1133 .na 1134 \fB\fB\&.sh.name\fR\fR 1135 .ad 1136 .RS 19n 1137 Set to the name of the variable at the time that a discipline function is 1138 invoked. 1139 .RE 1140 1141 .sp 1142 .ne 2 1143 .na 1144 \fB\fB\&.sh.subscript\fR\fR 1145 .ad 1146 .RS 19n 1147 Set to the name subscript of the variable at the time that a discipline 1148 function is invoked. 1149 .RE 1150 1151 .sp 1152 .ne 2 1153 .na 1154 \fB\fB\&.sh.subshell\fR\fR 1155 .ad 1156 .RS 19n 1157 The current depth for sub-shells and command substitution. 1158 .RE 1159 1160 .sp 1161 .ne 2 1162 .na 1163 \fB\fB\&.sh.value\fR\fR 1164 .ad 1165 .RS 19n 1166 Set to the value of the variable at the time that the set or append discipline 1167 function is invoked. 1168 .RE 1169 1170 .sp 1171 .ne 2 1172 .na 1173 \fB\fB\&.sh.version\fR\fR 1174 .ad 1175 .RS 19n 1176 Set to a value that identifies the version of this shell. 1177 .RE 1178 1179 .sp 1180 .ne 2 1181 .na 1182 \fB\fBLINENO\fR\fR 1183 .ad 1184 .RS 19n 1185 The current line number within the script or function being executed. 1186 .RE 1187 1188 .sp 1189 .ne 2 1190 .na 1191 \fB\fBOLDPWD\fR\fR 1192 .ad 1193 .RS 19n 1194 The previous working directory set by the \fBcd\fR command. 1195 .RE 1196 1197 .sp 1198 .ne 2 1199 .na 1200 \fB\fBOPTARG\fR\fR 1201 .ad 1202 .RS 19n 1203 The value of the last option argument processed by the \fBgetopts\fR built-in 1204 command. 1205 .RE 1206 1207 .sp 1208 .ne 2 1209 .na 1210 \fB\fBOPTIND\fR\fR 1211 .ad 1212 .RS 19n 1213 The index of the last option argument processed by the \fBgetopts\fR built-in 1214 command. 1215 .RE 1216 1217 .sp 1218 .ne 2 1219 .na 1220 \fB\fBPPID\fR\fR 1221 .ad 1222 .RS 19n 1223 The process number of the parent of the shell. 1224 .RE 1225 1226 .sp 1227 .ne 2 1228 .na 1229 \fB\fBPWD\fR\fR 1230 .ad 1231 .RS 19n 1232 The present working directory set by the \fBcd\fR command. 1233 .RE 1234 1235 .sp 1236 .ne 2 1237 .na 1238 \fB\fBRANDOM\fR\fR 1239 .ad 1240 .RS 19n 1241 Each time this variable is referenced, a random integer, uniformly distributed 1242 between \fB0\fR and \fB32767\fR, is generated. The sequence of random numbers 1243 can be initialized by assigning a numeric value to \fBRANDOM\fR. 1244 .RE 1245 1246 .sp 1247 .ne 2 1248 .na 1249 \fB\fBREPLY\fR\fR 1250 .ad 1251 .RS 19n 1252 This variable is set by the \fBselect\fR statement and by the \fBread\fR 1253 built-in command when no arguments are supplied. 1254 .RE 1255 1256 .sp 1257 .ne 2 1258 .na 1259 \fB\fBSECONDS\fR\fR 1260 .ad 1261 .RS 19n 1262 Each time this variable is referenced, the number of seconds since shell 1263 invocation is returned. If this variable is assigned a value, then the value 1264 returned upon reference is the value that was assigned plus the number of 1265 seconds since the assignment. 1266 .RE 1267 1268 .sp 1269 .LP 1270 The following variables are used by the shell: 1271 .sp 1272 .ne 2 1273 .na 1274 \fB\fBCDPATH\fR\fR 1275 .ad 1276 .RS 14n 1277 Defines the search path for the \fBcd\fR command. 1278 .RE 1279 1280 .sp 1281 .ne 2 1282 .na 1283 \fB\fBCOLUMNS\fR\fR 1284 .ad 1285 .RS 14n 1286 Defines the width of the edit window for the shell edit modes and for printing 1287 select lists. 1288 .RE 1289 1290 .sp 1291 .ne 2 1292 .na 1293 \fB\fBEDITOR\fR\fR 1294 .ad 1295 .RS 14n 1296 If the \fBVISUAL\fR variable is not set, the value of this variable is checked 1297 for the patterns as described with \fBVISUAL\fR and the corresponding editing 1298 option is turned on. 1299 .sp 1300 See the \fBset\fR command in the \fBSpecial Command\fR section of this manual 1301 page. 1302 .RE 1303 1304 .sp 1305 .ne 2 1306 .na 1307 \fB\fBENV\fR\fR 1308 .ad 1309 .RS 14n 1310 Performs parameter expansion, command substitution, and arithmetic substitution 1311 on the value to generate the pathname of the script that is executed when the 1312 shell is invoked. This file is typically used for alias and function 1313 definitions. The default value is \fB$HOME/.kshrc\fR. 1314 .sp 1315 See the \fBInvocation\fR section of this manual page. 1316 .sp 1317 \fBENV\fR is not set by the shell. 1318 .RE 1319 1320 .sp 1321 .ne 2 1322 .na 1323 \fB\fBFCEDIT\fR\fR 1324 .ad 1325 .RS 14n 1326 Obsolete name for the default editor name for the \fBhist\fR command. 1327 \fBFCEDIT\fR is not used when \fBHISTEDIT\fR is set. 1328 .sp 1329 The shell specifies a default value to \fBFCEDIT\fR. 1330 .RE 1331 1332 .sp 1333 .ne 2 1334 .na 1335 \fB\fBFIGNORE\fR\fR 1336 .ad 1337 .RS 14n 1338 A pattern that defines the set of file names that is ignored when performing 1339 file name matching. 1340 .RE 1341 1342 .sp 1343 .ne 2 1344 .na 1345 \fB\fBFPATH\fR\fR 1346 .ad 1347 .RS 14n 1348 The search path for function definitions. The directories in this path are 1349 searched for a file with the same name as the function or command when a 1350 function with the \fB-u\fR attribute is referenced and when a command is not 1351 found. If an executable file with the name of that command is found, then it is 1352 read and executed in the current environment. Unlike \fBPATH\fR, the current 1353 directory must be represented explicitly by dot (\fB\&.\fR) rather than by 1354 adjacent colon (\fB:\fR) characters or a beginning or ending colon (\fB:\fR). 1355 .RE 1356 1357 .sp 1358 .ne 2 1359 .na 1360 \fB\fBHISTCMD\fR\fR 1361 .ad 1362 .RS 14n 1363 The number of the current command in the history file. 1364 .RE 1365 1366 .sp 1367 .ne 2 1368 .na 1369 \fB\fBHISTEDIT\fR\fR 1370 .ad 1371 .RS 14n 1372 The name for the default editor name for the \fBhist\fR command. 1373 .RE 1374 1375 .sp 1376 .ne 2 1377 .na 1378 \fB\fBHISTFILE\fR\fR 1379 .ad 1380 .RS 14n 1381 If this variable is set when the shell is invoked, the value is the pathname of 1382 the file that is used to store the command history. See the \fBCommand 1383 Re-entry\fR section of this manual page. 1384 .RE 1385 1386 .sp 1387 .ne 2 1388 .na 1389 \fB\fBHISTSIZE\fR\fR 1390 .ad 1391 .RS 14n 1392 If this variable is set when the shell is invoked, then the number of 1393 previously entered commands that are accessible by this shell is greater than 1394 or equal to this number. The default is \fB512\fR. 1395 .RE 1396 1397 .sp 1398 .ne 2 1399 .na 1400 \fB\fBHOME\fR\fR 1401 .ad 1402 .RS 14n 1403 The default argument (home directory) for the \fBcd\fR command. 1404 .sp 1405 \fBHOME\fR is not set by the shell. \fBHOME\fR is set by \fBlogin\fR(1). 1406 .RE 1407 1408 .sp 1409 .ne 2 1410 .na 1411 \fB\fBIFS\fR\fR 1412 .ad 1413 .RS 14n 1414 Internal field separators, normally SPACE, TAB, and NEWLINE that are used to 1415 separate the results of command substitution or parameter expansion and to 1416 separate fields with the built-in command read. The first character of the 1417 \fBIFS\fR variable is used to separate arguments for the \fB"$*"\fR 1418 substitution. See the \fBQuoting\fR section of this manual page. 1419 .sp 1420 Each single occurrence of an \fBIFS\fR character in the string to be split, 1421 that is not in the \fBissspace\fR character class, and any adjacent characters 1422 in \fBIFS\fR that are in the \fBissspace\fR character class, delimit a field. 1423 One or more characters in IFS that belong to the \fBissspace\fR character 1424 class, delimit a field. In addition, if the same \fBissspace\fR character 1425 appears consecutively inside \fBIFS\fR, this character is treated as if it were 1426 not in the \fBissspace\fR class, so that if \fBIFS\fR consists of two tab 1427 characters, then two adjacent tab characters delimit a null field. 1428 .sp 1429 The shell specifies a default value to \fBIFS\fR. 1430 .RE 1431 1432 .sp 1433 .ne 2 1434 .na 1435 \fB\fBLANG\fR\fR 1436 .ad 1437 .RS 14n 1438 This variable determines the locale category for any category not specifically 1439 selected with a variable starting with \fBLC_\fR or \fBLANG\fR. 1440 .RE 1441 1442 .sp 1443 .ne 2 1444 .na 1445 \fB\fBLC_ALL\fR\fR 1446 .ad 1447 .RS 14n 1448 This variable overrides the value of the \fBLANG\fR variable and any other 1449 \fBLC_\fR variable. 1450 .RE 1451 1452 .sp 1453 .ne 2 1454 .na 1455 \fB\fBLC_COLLATE\fR\fR 1456 .ad 1457 .RS 14n 1458 This variable determines the locale category for character collation 1459 information. 1460 .RE 1461 1462 .sp 1463 .ne 2 1464 .na 1465 \fB\fBLC_CTYPE\fR\fR 1466 .ad 1467 .RS 14n 1468 This variable determines the locale category for character handling functions. 1469 It determines the character classes for pattern matching. See the \fBFile Name 1470 Generation\fR section of this manual page. 1471 .RE 1472 1473 .sp 1474 .ne 2 1475 .na 1476 \fB\fBLC_NUMERIC\fR\fR 1477 .ad 1478 .RS 14n 1479 This variable determines the locale category for the decimal point character. 1480 .RE 1481 1482 .sp 1483 .ne 2 1484 .na 1485 \fB\fBLINES\fR\fR 1486 .ad 1487 .RS 14n 1488 If this variable is set, the value is used to determine the column length for 1489 printing select lists. Select lists prints vertically until about two-thirds of 1490 \fBLINES\fR lines are filled. 1491 .RE 1492 1493 .sp 1494 .ne 2 1495 .na 1496 \fB\fBMAIL\fR\fR 1497 .ad 1498 .RS 14n 1499 If this variable is set to the name of a mail file \fBand\fR the \fBMAILPATH\fR 1500 variable is not set, then the shell informs the user of arrival of mail in the 1501 specified file. 1502 .sp 1503 \fBMAIL\fR is not set by the shell. On some systems, \fBMAIL\fR is set by 1504 \fBlogin\fR(1). 1505 .RE 1506 1507 .sp 1508 .ne 2 1509 .na 1510 \fB\fBMAILCHECK\fR\fR 1511 .ad 1512 .RS 14n 1513 Specifies how often in seconds the shell checks for changes in the modification 1514 time of any of the files specified by the \fBMAILPATH\fR or \fBMAIL\fR 1515 variables. The default value is \fB600\fR seconds. When the time has elapsed 1516 the shell checks before issuing the next prompt. 1517 .sp 1518 The shell specifies a default value to \fBMAILCHECK\fR. 1519 .RE 1520 1521 .sp 1522 .ne 2 1523 .na 1524 \fB\fBMAILPATH\fR\fR 1525 .ad 1526 .RS 14n 1527 A colon ( \fB:\fR ) separated list of file names. If this variable is set, then 1528 the shell informs the user of any modifications to the specified files that 1529 have occurred within the last \fBMAILCHECK\fR seconds. Each file name can be 1530 followed by a \fB?\fR and a message that is printed. The message undergoes 1531 parameter expansion, command substitution, and arithmetic substitution with the 1532 variable \fB$_\fR defined as the name of the file that has changed. The default 1533 message is \fByou have mail in $_\fR. 1534 .RE 1535 1536 .sp 1537 .ne 2 1538 .na 1539 \fB\fBPATH\fR\fR 1540 .ad 1541 .RS 14n 1542 The search path for commands. Except in \fB\&.profile\fR, users cannot change 1543 \fBPATH\fR if executing under \fBrksh93\fR. See the \fBExecution\fR section of 1544 this manual page. 1545 .sp 1546 The shell specifies a default value to \fBPATH\fR. 1547 .RE 1548 1549 .sp 1550 .ne 2 1551 .na 1552 \fB\fBPS1\fR\fR 1553 .ad 1554 .RS 14n 1555 The value of this variable is expanded for parameter expansion, command 1556 substitution, and arithmetic substitution to define the primary prompt string 1557 which by default is \fB$\fR. The character \fB!\fR in the primary prompt string 1558 is replaced by the command number. Two successive occurrences of \fB!\fR 1559 produces a single \fB!\fR when the prompt string is printed. See the \fBCommand 1560 Re-entry\fR section of this manual page. 1561 .sp 1562 The shell specifies a default value to \fBPS1\fR. 1563 .RE 1564 1565 .sp 1566 .ne 2 1567 .na 1568 \fB\fBPS2\fR\fR 1569 .ad 1570 .RS 14n 1571 Secondary prompt string, by default, \fB>\fR. 1572 .sp 1573 The shell specifies a default value to \fBPS2\fR. 1574 .RE 1575 1576 .sp 1577 .ne 2 1578 .na 1579 \fB\fBPS3\fR\fR 1580 .ad 1581 .RS 14n 1582 Selection prompt string used within a select loop, by default \fB#?\fR. 1583 .sp 1584 The shell specifies a default value to \fBPS3\fR. 1585 .RE 1586 1587 .sp 1588 .ne 2 1589 .na 1590 \fB\fBPS4\fR\fR 1591 .ad 1592 .RS 14n 1593 The value of this variable is expanded for parameter evaluation, command 1594 substitution, and arithmetic substitution and precedes each line of an 1595 execution trace. By default, \fBPS4\fR is \fB+\fR. When \fBPS4\fR is unset, the 1596 execution trace prompt is also \fB+\fR . 1597 .sp 1598 The shell specifies a default value to \fBPS4\fR. 1599 .RE 1600 1601 .sp 1602 .ne 2 1603 .na 1604 \fB\fBSHELL\fR\fR 1605 .ad 1606 .RS 14n 1607 The pathname of the shell is kept in the environment. At invocation, if the 1608 basename of this variable is \fBrsh\fR, \fBrksh\fR, \fBrksh93\fR, or 1609 \fBkrsh\fR, the shell becomes restricted. 1610 .sp 1611 \fBSHELL\fR is not set by the shell. On some systems, \fBSHELL\fR is set by 1612 \fBlogin\fR(1). 1613 .RE 1614 1615 .sp 1616 .ne 2 1617 .na 1618 \fB\fBTIMEFORMAT\fR\fR 1619 .ad 1620 .RS 14n 1621 The value of this parameter is used as a format string specifying how the 1622 timing information for pipelines prefixed with the \fBtime\fR reserved word 1623 should be displayed. The \fB%\fR character introduces a format sequence that is 1624 expanded to a time value or other information. 1625 .sp 1626 The format sequences and their meanings are as follows. 1627 .sp 1628 .ne 2 1629 .na 1630 \fB\fB%%\fR\fR 1631 .ad 1632 .sp .6 1633 .RS 4n 1634 A literal \fB%\fR. 1635 .RE 1636 1637 .sp 1638 .ne 2 1639 .na 1640 \fB\fB%[\fIp\fR][l]R\fR\fR 1641 .ad 1642 .sp .6 1643 .RS 4n 1644 The elapsed time in seconds. 1645 .RE 1646 1647 .sp 1648 .ne 2 1649 .na 1650 \fB\fB%[\fIp\fR][l]U\fR\fR 1651 .ad 1652 .sp .6 1653 .RS 4n 1654 The number of CPU seconds spent in user mode. 1655 .RE 1656 1657 .sp 1658 .ne 2 1659 .na 1660 \fB\fB%[\fIp\fR][l]S\fR\fR 1661 .ad 1662 .sp .6 1663 .RS 4n 1664 The number of CPU seconds spent in system mode. 1665 .RE 1666 1667 .sp 1668 .ne 2 1669 .na 1670 \fB\fB%P\fR\fR 1671 .ad 1672 .sp .6 1673 .RS 4n 1674 The CPU percentage, computed as \fB(U + S) / R\fR. 1675 .RE 1676 1677 The braces denote optional portions. The optional \fIp\fR is a digit specifying 1678 the \fIprecision\fR, the number of fractional digits after a decimal point. A 1679 value of \fB0\fR causes no decimal point or fraction to be output. At most 1680 three places after the decimal point can be displayed. Values of \fIp\fR 1681 greater than \fB3\fR are treated as \fB3\fR. If \fIp\fR is not specified, the 1682 value \fB3\fR is used. 1683 .sp 1684 The optional \fBl\fR specifies a longer format, including hours if greater than 1685 zero, minutes, and seconds of the form \fIHHhMMmSS.FFs\fR. The value of \fIp\fR 1686 determines whether or not the fraction is included. 1687 .sp 1688 All other characters are output without change and a trailing NEWLINE is added. 1689 If unset, the default value, \fB$'\enreal\et%2lR\enuser\et%2lU\ensys%2lS'\fR, 1690 is used. If the value is null, no timing information is displayed. 1691 .RE 1692 1693 .sp 1694 .ne 2 1695 .na 1696 \fB\fBTMOUT\fR\fR 1697 .ad 1698 .RS 14n 1699 If set to a value greater than zero, \fBTMOUT\fR is the default time-out value 1700 for the \fBread\fR built-in command. The \fBselect\fR compound command 1701 terminates after \fBTMOUT\fR seconds when input is from a terminal. Otherwise, 1702 the shell terminates if a line is not entered within the prescribed number of 1703 seconds while reading from a terminal. The shell can be compiled with a maximum 1704 bound for this value which cannot be exceeded. 1705 .sp 1706 The shell specifies a default value to \fBTMOUT\fR. 1707 .RE 1708 1709 .sp 1710 .ne 2 1711 .na 1712 \fB\fBVISUAL\fR\fR 1713 .ad 1714 .RS 14n 1715 If the value of this variable matches the pattern \fB*[Vv][Ii]*\fR, then the 1716 \fBvi\fR option is turned on. See \fBSpecial Commands\fR. If the value matches 1717 the pattern \fB*gmacs*\fR , the \fBgmacs\fR option is turned on. If the value 1718 matches the pattern \fB*macs*\fR, then the \fBemacs\fR option is turned on. The 1719 value of \fBVISUAL\fR overrides the value of \fBEDITOR\fR. 1720 .RE 1721 1722 .SS "Field Splitting" 1723 .LP 1724 After parameter expansion and command substitution, the results of 1725 substitutions are scanned for the field separator characters (those found in 1726 \fBIFS\fR) and split into distinct fields where such characters are found. 1727 Explicit null fields (\fB""\fR or \fB\&''\fR) are retained. Implicit null 1728 fields, those resulting from parameters that have no values or command 1729 substitutions with no output, are removed. 1730 .sp 1731 .LP 1732 If the \fBbraceexpand\fR (\fB-B\fR) option is set, each of the fields resulting 1733 from \fBIFS\fR are checked to see if they contain one or more of the brace 1734 patterns. Valid brace patterns: \fB{*\fR,\fB*}\fR, 1735 \fB{\fR\fIl1\fR\fB\&..\fR\fIl2\fR\fB}\fR , 1736 \fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR\fB}\fR, 1737 \fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR\fB%\fR\fIfmt\fR\fB} 1738 {\fR\fIn1\fR\fB\&..\fR\fIn2\fR \fB\&..\fR\fIn3\fR\fB}\fR, or 1739 \fB{\fR\fIn1\fR\fB\&..\fR\fIn2\fR \fB\&..\fR\fIn3\fR\fB%\fR\fIfmt\fR\fB}\fR , 1740 where \fB*\fR represents any character, \fIl1\fR,\fIl2\fR are letters and 1741 \fIn1\fR,\fIn2\fR,\fIn3\fR are signed numbers and \fIfmt\fR is a format 1742 specified as used by \fBprintf\fR. In each case, fields are created by 1743 prepending the characters before the \fB{\fR and appending the characters after 1744 the } to each of the strings generated by the characters between the \fB{\fR 1745 and \fB}\fR. The resulting fields are checked to see if they have any brace 1746 patterns. 1747 .sp 1748 .LP 1749 In the first form, a field is created for each string between \fB{\fR and 1750 \fB,,\fR between \fB,\fR and \fB,,\fR and between , and \fB}\fR. The string 1751 represented by \fB*\fR can contain embedded matching { and } without quoting. 1752 Otherwise, each \fB{\fR and \fB}\fR with \fB*\fR must be quoted. 1753 .sp 1754 .LP 1755 In the second form, \fIl1\fR and \fIl2\fR must both be either upper case or 1756 both be lower case characters in the C locale. In this case a field is created 1757 for each character from \fIl1\fR through \fIl2\fR. 1758 .sp 1759 .LP 1760 In the remaining forms, a field is created for each number starting at 1761 \fIn1\fR. This continues until it reaches \fIn2\fR and increments \fIn1\fR by 1762 \fIn3\fR. The cases where \fIn3\fR is not specified behave as if \fIn3\fR were 1763 1 if \fIn1\fR\fB<=\fR\fIn2\fR, and \fB-1\fR otherwise. In forms which specify 1764 \fB%\fR\fIfmt\fR, any format flags, widths and precisions can be specified and 1765 \fIfmt\fR can end in any of the specifiers \fBcdiouxX\fR. For example, 1766 \fB{a,z}{1..5..3%02d}{b..c}x\fR expands to the 8 fields, \fBa01bx, a01cx, 1767 a04bx, a04cx, z01bx, z01cx, z04bx,\fR and \fBz04cx\fR. 1768 .SS "File Name Generation" 1769 .LP 1770 Following splitting, each field is scanned for the characters \fB*\fR, \fB?\fR, 1771 \fB(\fR, and \fB[\fR, unless the \fB-f\fR option has been set. If one of these 1772 characters appears, then the word is regarded as a pattern. 1773 .sp 1774 .LP 1775 Each file name component that contains any pattern character is replaced with a 1776 lexicographically sorted set of names that matches the pattern from that 1777 directory. If no file name is found that matches the pattern, then that 1778 component of the file name is left unchanged unless the pattern is prefixed 1779 with \fB~(N)\fR in which case it is removed. If \fBFIGNORE\fR is set, then each 1780 file name component that matches the pattern defined by the value of 1781 \fBFIGNORE\fR is ignored when generating the matching file names. The names 1782 \fB\&.\fR and \fB\&..\fR are also ignored. If \fBFIGNORE\fR is not set, the 1783 character \fB\&.\fR at the start of each file name component is ignored unless 1784 the first character of the pattern corresponding to this component is the 1785 character \fB\&.\fR itself. For other uses of pattern matching the \fB/\fR and 1786 \fB\&.\fR are not specially treated. 1787 .sp 1788 .ne 2 1789 .na 1790 \fB\fB*\fR\fR 1791 .ad 1792 .RS 11n 1793 Match any string, including the null string. When used for file name expansion, 1794 if the \fBglobstar\fR option is on, two adjacent \fB*\fRs by themselves match 1795 all files and zero or more directories and subdirectories. If the two adjacent 1796 \fB*\fRs are followed by a \fB/\fR, only directories and subdirectories match. 1797 .RE 1798 1799 .sp 1800 .ne 2 1801 .na 1802 \fB\fB?\fR\fR 1803 .ad 1804 .RS 11n 1805 Matches any single character. 1806 .RE 1807 1808 .sp 1809 .ne 2 1810 .na 1811 \fB[\fB\&...\fR]\fR 1812 .ad 1813 .RS 11n 1814 Match any one of the enclosed characters. A pair of characters separated by 1815 \fB-\fR matches any character lexically between the pair, inclusive. If the 1816 first character following the opening \fB[\fR is a \fB!\fR, any character not 1817 enclosed is matched. A \fB-\fR can be included in the character set by putting 1818 it as the first or last character. Within \fB[\fR and \fB]\fR, character 1819 classes can be specified with the syntax \fB[:\fR\fIclass\fR\fB:]\fR where 1820 \fIclass\fR is one of the following classes defined in the \fBANSI-C\fR 1821 standard: 1822 .sp 1823 .in +2 1824 .nf 1825 \fIalnum alpha blank cntrl digit graph 1826 lower print punct space upper 1827 word xdigit\fR 1828 .fi 1829 .in -2 1830 .sp 1831 1832 \fIword\fR is equivalent to \fIalnum\fR plus the character \fB_\fR. Within 1833 \fB[\fR and \fB]\fR, an equivalence class can be specified with the syntax 1834 \fB[=\fR\fIc\fR\fB=]\fR which matches all characters with the same primary 1835 collation weight (as defined by the current locale) as the character \fIc\fR. 1836 Within \fB[\fR and \fB]\fR, [\fI\&.symbol.\fR] matches the collating symbol 1837 \fIsymbol\fR. 1838 .RE 1839 1840 .sp 1841 .LP 1842 A \fIpattern-list\fR is a list of one or more patterns separated from each 1843 other with an \fB&\fR or \fB|\fR. An \fB&\fR signifies that all patterns must 1844 be matched whereas \fB|\fR requires that only one pattern be matched. Composite 1845 patterns can be formed with one or more of the following sub-patterns: 1846 .sp 1847 .ne 2 1848 .na 1849 \fB\fB?(\fR\fIpattern-list\fR\fB)\fR\fR 1850 .ad 1851 .RS 22n 1852 Optionally matches any one of the specified patterns. 1853 .RE 1854 1855 .sp 1856 .ne 2 1857 .na 1858 \fB\fB*(\fR\fIpattern-list\fR\fB)\fR\fR 1859 .ad 1860 .RS 22n 1861 Matches zero or more occurrences of the specified patterns. 1862 .RE 1863 1864 .sp 1865 .ne 2 1866 .na 1867 \fB\fB+(\fR\fIpattern-list\fR\fB)\fR\fR 1868 .ad 1869 .RS 22n 1870 Matches one or more occurrences of the specified patterns. 1871 .RE 1872 1873 .sp 1874 .ne 2 1875 .na 1876 \fB\fB{\fR\fIn\fR\fB(\fR\fIpattern-list\fR\fB)\fR\fR 1877 .ad 1878 .RS 22n 1879 Matches \fIn\fR occurrences of the specified patterns. 1880 .RE 1881 1882 .sp 1883 .ne 2 1884 .na 1885 \fB\fB{\fR\fIm\fR\fB,\fR\fIn\fR\fB(\fR\fIpattern-list\fR\fB)\fR\fR 1886 .ad 1887 .RS 22n 1888 Matches from \fIm\fR to \fIn\fR occurrences of the specified patterns. If 1889 \fIm\fR is omitted, \fB0\fR is used. If \fIn\fR is omitted at least \fIm\fR 1890 occurrences are matched. 1891 .RE 1892 1893 .sp 1894 .ne 2 1895 .na 1896 \fB\fB@(\fR\fIpattern-list\fR\fB)\fR\fR 1897 .ad 1898 .RS 22n 1899 Matches exactly one of the specified patterns. 1900 .RE 1901 1902 .sp 1903 .ne 2 1904 .na 1905 \fB\fB!(\fR\fIpattern-list\fR\fB)\fR\fR 1906 .ad 1907 .RS 22n 1908 Matches anything except one of the specified patterns. 1909 .RE 1910 1911 .sp 1912 .LP 1913 By default, each pattern, or sub-pattern matches the longest string possible 1914 consistent with generating the longest overall match. If more than one match is 1915 possible, the one starting closest to the beginning of the string is chosen. 1916 However, for each of the compound patterns a \fB-\fR can be inserted in front 1917 of the \fB(\fR to cause the shortest match to the specified \fIpattern-list\fR 1918 to be used. 1919 .sp 1920 .LP 1921 When \fIpattern-list\fR is contained within parentheses, the backslash 1922 character \fB\e\fR is treated specially even when inside a character class. All 1923 \fBANSI-C\fR character escapes are recognized and match the specified 1924 character. In addition the following escape sequences are recognized: 1925 .sp 1926 .ne 2 1927 .na 1928 \fB\fB\ed\fR\fR 1929 .ad 1930 .RS 7n 1931 Matches any character in the digit class. 1932 .RE 1933 1934 .sp 1935 .ne 2 1936 .na 1937 \fB\fB\eD\fR\fR 1938 .ad 1939 .RS 7n 1940 Matches any character not in the digit class. 1941 .RE 1942 1943 .sp 1944 .ne 2 1945 .na 1946 \fB\fB\es\fR\fR 1947 .ad 1948 .RS 7n 1949 Matches any character in the space class. 1950 .RE 1951 1952 .sp 1953 .ne 2 1954 .na 1955 \fB\fB\eS\fR\fR 1956 .ad 1957 .RS 7n 1958 Matches any character not in the space class. 1959 .RE 1960 1961 .sp 1962 .ne 2 1963 .na 1964 \fB\fB\ew\fR\fR 1965 .ad 1966 .RS 7n 1967 Matches any character in the word class. 1968 .RE 1969 1970 .sp 1971 .ne 2 1972 .na 1973 \fB\fB\eW\fR\fR 1974 .ad 1975 .RS 7n 1976 Matches any character not in the word class. 1977 .RE 1978 1979 .sp 1980 .LP 1981 A pattern of the form \fB%(\fR\fIpattern-pairs\fR\fB)\fR is a sub-pattern that 1982 can be used to match nested character expressions. Each \fIpattern-pair\fR is a 1983 two character sequence which cannot contain \fB&\fR or \fB|\fR. The first 1984 \fIpattern-pair\fR specifies the starting and ending characters for the match. 1985 Each subsequent \fIpattern-pair\fR represents the beginning and ending 1986 characters of a nested group that is skipped over when counting starting and 1987 ending character matches. The behavior is unspecified when the first character 1988 of a \fIpattern-pair\fR is alphanumeric except for the following: 1989 .sp 1990 .ne 2 1991 .na 1992 \fB\fBD\fR\fR 1993 .ad 1994 .RS 5n 1995 Causes the ending character to terminate the search for this pattern without 1996 finding a match. 1997 .RE 1998 1999 .sp 2000 .ne 2 2001 .na 2002 \fB\fBE\fR\fR 2003 .ad 2004 .RS 5n 2005 Causes the ending character to be interpreted as an escape character. 2006 .RE 2007 2008 .sp 2009 .ne 2 2010 .na 2011 \fB\fBL\fR\fR 2012 .ad 2013 .RS 5n 2014 Causes the ending character to be interpreted as a quote character causing all 2015 characters to be ignored when looking for a match. 2016 .RE 2017 2018 .sp 2019 .ne 2 2020 .na 2021 \fB\fBQ\fR\fR 2022 .ad 2023 .RS 5n 2024 Causes the ending character to be interpreted as a quote character causing all 2025 characters other than any escape character to be ignored when looking for a 2026 match. 2027 .RE 2028 2029 .sp 2030 .LP 2031 \fB%({}Q"E\e)\fR, matches characters starting at \fB{\fR until the matching 2032 \fB}\fR is found not counting any \fB{\fR or \fB}\fR that is inside a double 2033 quoted string or preceded by the escape character \fB\e\fR\&. Without the 2034 \fB{}\fR this pattern matches any C language string. 2035 .sp 2036 .LP 2037 Each sub-pattern in a composite pattern is numbered, starting at \fB1\fR, by 2038 the location of the \fB(\fR within the pattern. The sequence \fB\e\fR\fIn\fR, 2039 where \fIn\fR is a single digit and \fB\e\fR\fIn\fR comes after the \fIn\fRth. 2040 sub-pattern, matches the same string as the sub-pattern itself. 2041 .sp 2042 .LP 2043 A pattern can contain sub-patterns of the form 2044 \fB~(\fR\fIoptions\fR\fB:\fR\fIpattern-list\fR\fB)\fR, where either 2045 \fIoptions\fR or \fB:\fR\fIpattern-list\fR can be omitted. Unlike the other 2046 compound patterns, these sub-patterns are not counted in the numbered 2047 sub-patterns. If \fIoptions\fR is present, it can consist of one or more of the 2048 following: 2049 .sp 2050 .ne 2 2051 .na 2052 \fB\fB+\fR\fR 2053 .ad 2054 .RS 5n 2055 Enable the following options. This is the default. 2056 .RE 2057 2058 .sp 2059 .ne 2 2060 .na 2061 \fB\fB-\fR\fR 2062 .ad 2063 .RS 5n 2064 Disable the following options. 2065 .RE 2066 2067 .sp 2068 .ne 2 2069 .na 2070 \fB\fBE\fR\fR 2071 .ad 2072 .RS 5n 2073 The remainder of the pattern uses extended regular expression syntax like the 2074 \fBegrep\fR(1) command. 2075 .RE 2076 2077 .sp 2078 .ne 2 2079 .na 2080 \fB\fBF\fR\fR 2081 .ad 2082 .RS 5n 2083 The remainder of the pattern uses \fBfgrep\fR(1) expression syntax. 2084 .RE 2085 2086 .sp 2087 .ne 2 2088 .na 2089 \fB\fBg\fR\fR 2090 .ad 2091 .RS 5n 2092 File the longest match (greedy). 2093 .sp 2094 This is the default. 2095 .RE 2096 2097 .sp 2098 .ne 2 2099 .na 2100 \fB\fBG\fR\fR 2101 .ad 2102 .RS 5n 2103 The remainder of the pattern uses basic regular expression syntax like the 2104 \fBgrep\fR(1) command. 2105 .RE 2106 2107 .sp 2108 .ne 2 2109 .na 2110 \fB\fBi\fR\fR 2111 .ad 2112 .RS 5n 2113 Treat the match as case insensitive. 2114 .RE 2115 2116 .sp 2117 .ne 2 2118 .na 2119 \fB\fBK\fR\fR 2120 .ad 2121 .RS 5n 2122 The remainder of the pattern uses shell pattern syntax. 2123 .sp 2124 This is the default. 2125 .RE 2126 2127 .sp 2128 .ne 2 2129 .na 2130 \fB\fBl\fR\fR 2131 .ad 2132 .RS 5n 2133 Left anchor the pattern. 2134 .sp 2135 This is the default for \fBK\fR style patterns. 2136 .RE 2137 2138 .sp 2139 .ne 2 2140 .na 2141 \fB\fBN\fR\fR 2142 .ad 2143 .RS 5n 2144 This is ignored. However, when it is the first letter and is used with file 2145 name generation, and no matches occur, the file pattern expands to the empty 2146 string. 2147 .RE 2148 2149 .sp 2150 .ne 2 2151 .na 2152 \fB\fBr\fR\fR 2153 .ad 2154 .RS 5n 2155 Right anchor the pattern. 2156 .sp 2157 This is the default for \fBK\fR style patterns. 2158 .RE 2159 2160 .sp 2161 .LP 2162 If both \fIoptions\fR and \fB:\fR\fIpattern-list\fR are specified, then the 2163 options apply only to \fIpattern-list\fR. Otherwise, these options remain in 2164 effect until they are disabled by a subsequent \fB~(...)\fR or at the end of 2165 the sub-pattern containing \fB~(...)\fR. 2166 .SS "Quoting" 2167 .LP 2168 Each of the metacharacters listed in the \fBDefinitions\fR has a special 2169 meaning to the shell. 2170 .sp 2171 .ne 2 2172 .na 2173 \fB\fBg\fR\fR 2174 .ad 2175 .RS 5n 2176 File the longest match (greedy). This is the default. 2177 .RE 2178 2179 .sp 2180 .ne 2 2181 .na 2182 \fB\fBi\fR\fR 2183 .ad 2184 .RS 5n 2185 Treat the match as case insensitive. 2186 .RE 2187 2188 .sp 2189 .LP 2190 If both \fIoptions\fR and \fB:\fR\fIpattern-list\fR are specified, then the 2191 options apply only to \fIpattern-list\fR. Otherwise, the options remain in 2192 effect until they are disabled by a subsequent \fB~(...)\fR or at the end of 2193 the sub-pattern containing \fB~(...)\fR. 2194 .sp 2195 .LP 2196 Each of the metacharacters listed in the \fBDefinitions\fR section of this 2197 manual page has a special meaning to the shell and causes termination of a word 2198 unless quoted. A character can be quoted, that is, made to stand for itself, by 2199 preceding it with a backslash (\fB\e\fR). The pair \fB\e\fRNEWLINE is removed. 2200 All characters enclosed between a pair of single quote marks (\fB\&''\fR) that 2201 is not preceded by a \fB$\fR are quoted. A single quote cannot appear within 2202 the single quotes. A single quoted string preceded by an unquoted \fB$\fR is 2203 processed as an \fBANSI-C\fR string except for the following: 2204 .sp 2205 .ne 2 2206 .na 2207 \fB\fB\e0\fR\fR 2208 .ad 2209 .RS 19n 2210 Causes the remainder of the string to be ignored. 2211 .RE 2212 2213 .sp 2214 .ne 2 2215 .na 2216 \fB\fB\ec\fR\fIx\fR\fR 2217 .ad 2218 .RS 19n 2219 Expands to the character CTRL-x. 2220 .RE 2221 2222 .sp 2223 .ne 2 2224 .na 2225 \fB\fB\eC\fR[\fB\&.\fR\fIname\fR\fB\&.\fR]\fR 2226 .ad 2227 .RS 19n 2228 Expands to the collating element \fIname\fR. 2229 .RE 2230 2231 .sp 2232 .ne 2 2233 .na 2234 \fB\fB\ee\fR\fR 2235 .ad 2236 .RS 19n 2237 Equivalent to the escape character (\fBASCII\fR 033), 2238 .RE 2239 2240 .sp 2241 .ne 2 2242 .na 2243 \fB\fB\eE\fR\fR 2244 .ad 2245 .RS 19n 2246 Equivalent to the escape character (\fBASCII\fR 033), 2247 .RE 2248 2249 .sp 2250 .LP 2251 Inside double quote marks (\fB""\fR), parameter and command substitution occur 2252 and \fB\e\fR quotes the characters \fB\e\fR, \fB`\fR, \fB"\fR, and \fB$\fR. A 2253 \fB$\fR in front of a double quoted string is ignored in the \fBC\fR or 2254 \fBPOSIX\fR locale, and might cause the string to be replaced by a locale 2255 specific string otherwise. The meaning of \fB$*\fR and \fB$@\fR is identical 2256 when not quoted or when used as a variable assignment value or as a file name. 2257 However, when used as a command argument, \fB"$*"\fR is equivalent to 2258 \fB"$1\fId\fR$2\fId\fR..."\fR, where \fId\fR is the first character of the IFS 2259 variable, whereas \fB"$@"\fR is equivalent to \fB"$1" "$2" ....\fR Inside grave 2260 quote marks (\fB``\fR), \fB\\fR quotes the characters \fB\e\fR, \fB`\fR, and 2261 \fB$\fR. If the grave quotes occur within double quotes, then \fB\e\fR also 2262 quotes the character \fB"\fR. 2263 .sp 2264 .LP 2265 The special meaning of reserved words or aliases can be removed by quoting any 2266 character of the reserved word. The recognition of function names or built-in 2267 command names cannot be altered by quoting them. 2268 .SS "Arithmetic Evaluation" 2269 .LP 2270 The shell performs arithmetic evaluation for arithmetic substitution, to 2271 evaluate an arithmetic command, to evaluate an indexed array subscript, and to 2272 evaluate arguments to the built-in commands \fBshift\fR and \fBlet\fR. 2273 Arithmetic evaluation is also performed on argument operands of the built-in 2274 command printf that correspond to numeric format specifiers in the format 2275 operand. See \fBprintf\fR(1). Evaluations are performed using double precision 2276 floating point arithmetic or long double precision floating point for systems 2277 that provide this data type. Floating point constants follow the \fBANSI-C\fR 2278 programming language floating point conventions. Integer constants follow the 2279 \fBANSI-C\fR programming language integer constant conventions although only 2280 single byte character constants are recognized and character casts are not 2281 recognized. Constants can be of the form \fB[\fR\fIbase#\fR\fB]\fR\fIn\fR where 2282 \fIbase\fR is a decimal number between two and sixty-four representing the 2283 arithmetic base and \fIn\fR is a number in that base. The digits greater than 2284 \fB9\fR are represented by the lower case letters, the upper case letters, 2285 \fB@\fR, and \fB_\fR respectively. For bases less than or equal to \fB36\fR, 2286 upper and lower case characters can be used interchangeably. 2287 .sp 2288 .LP 2289 An arithmetic expression uses the same syntax, precedence, and associativity of 2290 expression as the C language. All the C language operators that apply to 2291 floating point quantities can be used. In addition, the operator \fB**\fR can 2292 be used for exponentiation. It has higher precedence than multiplication and is 2293 left associative. When the value of an arithmetic variable or subexpression can 2294 be represented as a long integer, all C language integer arithmetic operations 2295 can be performed. Variables can be referenced by name within an arithmetic 2296 expression without using the parameter expansion syntax. When a variable is 2297 referenced, its value is evaluated as an arithmetic expression. 2298 .sp 2299 .LP 2300 Any of the following math library functions that are in the C math library can 2301 be used within an arithmetic expression: 2302 .sp 2303 .in +2 2304 .nf 2305 abs acos acosh asin asinh atan atan2 atanh cbrt 2306 copysign cos cosh erf erfc exp exp2 expm1 fabs 2307 fdim finite floor fma fmax fmod hypot ilogb 2308 int isinf isnan lgamma log log2 logb 2309 nearbyint nextafter nexttoward pow remainder 2310 rint round sin sinh sqrt tan tanh tgamma trunc 2311 .fi 2312 .in -2 2313 .sp 2314 2315 .sp 2316 .LP 2317 An internal representation of a \fIvariable\fR as a double precision floating 2318 point can be specified with the \fB-E [\fR\fIn\fR\fB]\fR or \fB-F 2319 [\fR\fIn\fR\fB]\fR option of the \fBtypeset\fR special built-in command. The 2320 \fB-E\fR option causes the expansion of the value to be represented using 2321 scientific notation when it is expanded. The optional option argument \fIn\fR 2322 defines the number of significant figures. The \fB-F\fR option causes the 2323 expansion to be represented as a floating decimal number when it is expanded. 2324 The optional option argument \fIn\fR defines the number of places after the 2325 decimal point in this case. 2326 .sp 2327 .LP 2328 An internal integer representation of a \fIvariable\fR can be specified with 2329 the \fB-i\fR \fB[\fR\fIn\fR\fB]\fR option of the \fBtypeset\fR special built-in 2330 command. The optional option argument \fIn\fR specifies an arithmetic base to 2331 be used when expanding the variable. If you do not specify an arithmetic base, 2332 base 10 is used. 2333 .sp 2334 .LP 2335 Arithmetic evaluation is performed on the value of each assignment to a 2336 variable with the \fB-E\fR, \fB-F\fR, or \fB-i\fR option. Assigning a floating 2337 point number to a variable whose type is an integer causes the fractional part 2338 to be truncated. 2339 .SS "Prompting" 2340 .LP 2341 When used interactively, the shell prompts with the value of \fBPS1\fR after 2342 expanding it for parameter expansion, command substitution, and arithmetic 2343 substitution, before reading a command. In addition, each single \fB!\fR in the 2344 prompt is replaced by the command number. A \fB!!\fR is required to place 2345 \fB!\fR in the prompt. If at any time a NEWLINE is typed and further input is 2346 needed to complete a command, then the secondary prompt, that is, the value of 2347 \fBPS2\fR, is issued. 2348 .SS "Conditional Expressions" 2349 .LP 2350 A \fBconditional expression\fR is used with the \fB[[\fR compound command to 2351 test attributes of files and to compare strings. Field splitting and file name 2352 generation are not performed on the words between \fB[[\fR and \fB]]\fR. 2353 .sp 2354 .LP 2355 Each expression can be constructed from one or more of the following unary or 2356 binary expressions: 2357 .sp 2358 .ne 2 2359 .na 2360 \fB\fB-a\fR \fIfile\fR\fR 2361 .ad 2362 .RS 21n 2363 True, if \fIfile\fR exists. 2364 .sp 2365 This option is the same as \fB-e\fR. This option is obsolete. 2366 .RE 2367 2368 .sp 2369 .ne 2 2370 .na 2371 \fB\fB-b\fR \fIfile\fR\fR 2372 .ad 2373 .RS 21n 2374 True, if \fIfile\fR exists and is a block special file. 2375 .RE 2376 2377 .sp 2378 .ne 2 2379 .na 2380 \fB\fB-c\fR \fIfile\fR\fR 2381 .ad 2382 .RS 21n 2383 True, if \fIfile\fR exists and is a character special file. 2384 .RE 2385 2386 .sp 2387 .ne 2 2388 .na 2389 \fB\fB-d\fR \fIfile\fR\fR 2390 .ad 2391 .RS 21n 2392 True, if \fIfile\fR exists and is a directory. 2393 .RE 2394 2395 .sp 2396 .ne 2 2397 .na 2398 \fB\fB-e\fR \fIfile\fR\fR 2399 .ad 2400 .RS 21n 2401 True, if \fIfile\fR exists. 2402 .RE 2403 2404 .sp 2405 .ne 2 2406 .na 2407 \fB\fB-f\fR \fIfile\fR\fR 2408 .ad 2409 .RS 21n 2410 True, if \fIfile\fR exists and is an ordinary file. 2411 .RE 2412 2413 .sp 2414 .ne 2 2415 .na 2416 \fB\fB-g\fR \fIfile\fR\fR 2417 .ad 2418 .RS 21n 2419 True, if \fIfile\fR exists and it has its \fBsetgid\fR bit set. 2420 .RE 2421 2422 .sp 2423 .ne 2 2424 .na 2425 \fB\fB-G\fR \fIfile\fR\fR 2426 .ad 2427 .RS 21n 2428 True, if \fIfile\fR exists and its group matches the effective group id of this 2429 process. 2430 .RE 2431 2432 .sp 2433 .ne 2 2434 .na 2435 \fB\fB-h\fR \fIfile\fR\fR 2436 .ad 2437 .RS 21n 2438 True, if \fIfile\fR exists and is a symbolic link. 2439 .RE 2440 2441 .sp 2442 .ne 2 2443 .na 2444 \fB\fB-k\fR \fIfile\fR\fR 2445 .ad 2446 .RS 21n 2447 True, if \fIfile\fR exists and it has its sticky bit set. 2448 .RE 2449 2450 .sp 2451 .ne 2 2452 .na 2453 \fB\fB-L\fR \fIfile\fR\fR 2454 .ad 2455 .RS 21n 2456 True, if \fIfile\fR exists and is a symbolic link. 2457 .RE 2458 2459 .sp 2460 .ne 2 2461 .na 2462 \fB\fB-n\fR \fIstring\fR\fR 2463 .ad 2464 .RS 21n 2465 True, if length of \fIstring\fR is \fBnon-zero\fR. 2466 .RE 2467 2468 .sp 2469 .ne 2 2470 .na 2471 \fB\fB-N\fR \fIfile\fR\fR 2472 .ad 2473 .RS 21n 2474 True, if \fIfile\fR exists and the modification time is greater than the last 2475 access time. 2476 .RE 2477 2478 .sp 2479 .ne 2 2480 .na 2481 \fB\fB-o\fR \fIoption\fR\fR 2482 .ad 2483 .RS 21n 2484 True, if option named \fIoption\fR is on. 2485 .RE 2486 2487 .sp 2488 .ne 2 2489 .na 2490 \fB\fB-o\fR \fI?option\fR\fR 2491 .ad 2492 .RS 21n 2493 True, if option named \fIoption\fR is a valid option name. 2494 .RE 2495 2496 .sp 2497 .ne 2 2498 .na 2499 \fB\fB-O\fR \fIfile\fR\fR 2500 .ad 2501 .RS 21n 2502 True, if \fIfile\fR exists and is owned by the effective user id of this 2503 process. 2504 .RE 2505 2506 .sp 2507 .ne 2 2508 .na 2509 \fB\fB-p\fR \fIfile\fR\fR 2510 .ad 2511 .RS 21n 2512 True, if \fIfile\fR exists and is a \fBFIFO\fR special file or a pipe. 2513 .RE 2514 2515 .sp 2516 .ne 2 2517 .na 2518 \fB\fB-r\fR \fIfile\fR\fR 2519 .ad 2520 .RS 21n 2521 True, if \fIfile\fR exists and is readable by current process. 2522 .RE 2523 2524 .sp 2525 .ne 2 2526 .na 2527 \fB\fB-s\fR \fIfile\fR\fR 2528 .ad 2529 .RS 21n 2530 True, if \fIfile\fR exists and has size greater than zero. 2531 .RE 2532 2533 .sp 2534 .ne 2 2535 .na 2536 \fB\fB-S\fR \fIfile\fR\fR 2537 .ad 2538 .RS 21n 2539 True, if \fIfile\fR exists and is a socket. 2540 .RE 2541 2542 .sp 2543 .ne 2 2544 .na 2545 \fB\fB-t\fR \fIfildes\fR\fR 2546 .ad 2547 .RS 21n 2548 True, if file descriptor number \fIfildes\fR is open and associated with a 2549 terminal device. 2550 .RE 2551 2552 .sp 2553 .ne 2 2554 .na 2555 \fB\fB-u\fR \fIfile\fR\fR 2556 .ad 2557 .RS 21n 2558 True, if \fIfile\fR exists and it has its \fBsetuid\fR bit set. 2559 .RE 2560 2561 .sp 2562 .ne 2 2563 .na 2564 \fB\fB-w\fR \fIfile\fR\fR 2565 .ad 2566 .RS 21n 2567 True, if \fIfile\fR exists and is writable by current process. 2568 .RE 2569 2570 .sp 2571 .ne 2 2572 .na 2573 \fB\fB-x\fR \fIfile\fR\fR 2574 .ad 2575 .RS 21n 2576 True, if \fIfile\fR exists and is executable by current process. If \fIfile\fR 2577 exists and is a directory, then true if the current process has permission to 2578 search in the directory. 2579 .RE 2580 2581 .sp 2582 .ne 2 2583 .na 2584 \fB\fB-z\fR \fIstring\fR\fR 2585 .ad 2586 .RS 21n 2587 True, if length of \fIstring\fR is zero. 2588 .RE 2589 2590 .sp 2591 .ne 2 2592 .na 2593 \fB\fIfile1\fR \fB-ef\fR \fIfile2\fR\fR 2594 .ad 2595 .RS 21n 2596 True, if \fIfile1\fR and \fIfile2\fR exist and refer to the same file. 2597 .RE 2598 2599 .sp 2600 .ne 2 2601 .na 2602 \fB\fIfile1\fR \fB-nt\fR \fIfile2\fR\fR 2603 .ad 2604 .RS 21n 2605 True, if \fIfile1\fR exists and \fIfile2\fR does not, or \fIfile1\fR is newer 2606 than \fIfile2\fR. 2607 .RE 2608 2609 .sp 2610 .ne 2 2611 .na 2612 \fB\fIfile1\fR \fB-ot\fR \fIfile2\fR\fR 2613 .ad 2614 .RS 21n 2615 True, if \fIfile2\fR exists and \fIfile1\fR does not, or \fIfile1\fR is older 2616 than \fIfile2\fR. 2617 .RE 2618 2619 .sp 2620 .ne 2 2621 .na 2622 \fB\fIstring\fR\fR 2623 .ad 2624 .RS 21n 2625 True, if \fIstring\fR is not null. 2626 .RE 2627 2628 .sp 2629 .ne 2 2630 .na 2631 \fB\fIstring\fR \fB==\fR \fIpattern\fR\fR 2632 .ad 2633 .RS 21n 2634 True, if \fIstring\fR matches \fIpattern\fR. Any part of \fIpattern\fR can be 2635 quoted to cause it to be matched as a string. With a successful match to 2636 \fIpattern\fR, the \fB\&.sh.match\fR array variable contains the match and 2637 sub-pattern matches. 2638 .RE 2639 2640 .sp 2641 .ne 2 2642 .na 2643 \fB\fIstring\fR \fB=\fR \fIpattern\fR\fR 2644 .ad 2645 .RS 21n 2646 Same as \fB==\fR, but is obsolete. 2647 .RE 2648 2649 .sp 2650 .ne 2 2651 .na 2652 \fB\fIstring\fR \fB!=\fR \fIpattern\fR\fR 2653 .ad 2654 .RS 21n 2655 True, if \fIstring\fR does not match \fIpattern\fR. When the \fIstring\fR 2656 matches the \fIpattern\fR the \fB\&.sh.match\fR array variable contains the 2657 match and sub-pattern matches. 2658 .RE 2659 2660 .sp 2661 .ne 2 2662 .na 2663 \fB\fIstring\fR \fB=~\fR \fIere\fR\fR 2664 .ad 2665 .RS 21n 2666 True if \fIstring\fR matches the pattern \fB~(E)\fR\fIere\fR where \fIere\fR is 2667 an extended regular expression. 2668 .RE 2669 2670 .sp 2671 .ne 2 2672 .na 2673 \fB\fIstring1\fR \fB<\fR \fIstring2\fR\fR 2674 .ad 2675 .RS 21n 2676 True, if \fIstring1\fR comes before \fIstring2\fR based on \fBASCII\fR value of 2677 their characters. 2678 .RE 2679 2680 .sp 2681 .ne 2 2682 .na 2683 \fB\fIstring1\fR \fB>\fR \fIstring2\fR\fR 2684 .ad 2685 .RS 21n 2686 True, if \fIstring1\fR comes after \fIstring2\fR based on \fBASCII\fR value of 2687 their characters. 2688 .RE 2689 2690 .sp 2691 .LP 2692 In each of the following expressions, if \fIfile\fR is of the form 2693 \fB/dev/fd/\fR\fIn\fR, where \fIn\fR is an integer, the test is applied to the 2694 open file whose descriptor number is \fIn\fR. The following obsolete arithmetic 2695 comparisons are supported: 2696 .sp 2697 .ne 2 2698 .na 2699 \fB\fIexp1\fR \fB-eq\fR \fIexp2\fR\fR 2700 .ad 2701 .RS 17n 2702 True, if \fIexp1\fR is equal to \fIexp2\fR. 2703 .RE 2704 2705 .sp 2706 .ne 2 2707 .na 2708 \fB\fIexp1\fR \fB-ge\fR \fIexp2\fR\fR 2709 .ad 2710 .RS 17n 2711 True, if \fIexp1\fR is greater than or equal to \fIexp2\fR. 2712 .RE 2713 2714 .sp 2715 .ne 2 2716 .na 2717 \fB\fIexp1\fR \fB-gt\fR \fIexp2\fR\fR 2718 .ad 2719 .RS 17n 2720 True, if \fIexp1\fR is greater than \fIexp2\fR. 2721 .RE 2722 2723 .sp 2724 .ne 2 2725 .na 2726 \fB\fIexp1\fR \fB-le\fR \fIexp2\fR\fR 2727 .ad 2728 .RS 17n 2729 True, if \fIexp1\fR is less than or equal to \fIexp2\fR. 2730 .RE 2731 2732 .sp 2733 .ne 2 2734 .na 2735 \fB\fIexp1\fR \fB-lt\fR \fIexp2\fR\fR 2736 .ad 2737 .RS 17n 2738 True, if \fIexp1\fR is less than \fIexp2\fR. 2739 .RE 2740 2741 .sp 2742 .ne 2 2743 .na 2744 \fB\fIexp1\fR \fB-ne\fR \fIexp2\fR\fR 2745 .ad 2746 .RS 17n 2747 True, if \fIexp1\fR is not equal to \fIexp2\fR. 2748 .RE 2749 2750 .sp 2751 .LP 2752 A compound expression can be constructed from these primitives by using any of 2753 the following, listed in decreasing order of precedence: 2754 .sp 2755 .ne 2 2756 .na 2757 \fB\fB(\fR\fIexpression\fR\fB)\fR\fR 2758 .ad 2759 .RS 30n 2760 True, if \fIexpression\fR is true. Used to group expressions. 2761 .RE 2762 2763 .sp 2764 .ne 2 2765 .na 2766 \fB\fB!\fR \fIexpression\fR\fR 2767 .ad 2768 .RS 30n 2769 True, if \fIexpression\fR is false. 2770 .RE 2771 2772 .sp 2773 .ne 2 2774 .na 2775 \fB\fIexpression1\fR \fB&&\fR \fIexpression2\fR\fR 2776 .ad 2777 .RS 30n 2778 True, if \fIexpression1\fR and \fIexpression2\fR are both true. 2779 .RE 2780 2781 .sp 2782 .ne 2 2783 .na 2784 \fB\fIexpression1\fR \fB||\fR \fIexpression2\fR\fR 2785 .ad 2786 .RS 30n 2787 True, if either \fIexpression1\fR or \fIexpression2\fR is true. 2788 .RE 2789 2790 .SS "Input and Output" 2791 .LP 2792 Before a command is executed, its input and output can be redirected using a 2793 special notation interpreted by the shell. The following can appear anywhere in 2794 a simple command or can precede or follow a command and are \fBnot\fR passed on 2795 to the invoked command. Command substitution, parameter expansion, and 2796 arithmetic substitution occur before \fIword\fR or \fIdigit\fR is used except 2797 as noted in this section. File name generation occurs only if the shell is 2798 interactive and the pattern matches a single file. Field splitting is not 2799 performed. 2800 .sp 2801 .LP 2802 In each of the following redirections, if \fIfile\fR is of the form 2803 \fB/dev/sctp/\fR\fIhost\fR\fB/\fR\fIport\fR, 2804 \fB/dev/tcp/\fR\fIhost\fR\fB/\fR\fIport\fR, or 2805 \fB/dev/udp/\fR\fIhost\fR\fB/\fR\fIport\fR, where \fIhost\fR is a hostname or 2806 host address, and \fIport\fR is a service specified by name or an integer port 2807 number, then the redirection attempts to make a \fBtcp\fR, \fBsctp\fR or 2808 \fBudp\fR connection to the corresponding socket. 2809 .sp 2810 .LP 2811 No intervening space is allowed between the characters of redirection 2812 operators. 2813 .sp 2814 .ne 2 2815 .na 2816 \fB\fB<\fR\fIword\fR\fR 2817 .ad 2818 .RS 14n 2819 Use file \fIword\fR as standard input (file descriptor 0). 2820 .RE 2821 2822 .sp 2823 .ne 2 2824 .na 2825 \fB\fB>\fR\fIword\fR\fR 2826 .ad 2827 .RS 14n 2828 Use file \fIword\fR as standard output (file descriptor 1). If the file does 2829 not exist then it is created. If the file exists, and the \fBnoclobber\fR 2830 option is on, this causes an error. Otherwise, it is truncated to zero length. 2831 .RE 2832 2833 .sp 2834 .ne 2 2835 .na 2836 \fB\fB>|\fR\fIword\fR\fR 2837 .ad 2838 .RS 14n 2839 Same as \fB>\fR, except that it overrides the \fBnoclobber\fR option. 2840 .RE 2841 2842 .sp 2843 .ne 2 2844 .na 2845 \fB\fB>>\fR\fIword\fR\fR 2846 .ad 2847 .RS 14n 2848 Use file \fIword\fR as standard output. If the file exists, then output is 2849 appended to it (by first seeking to the end-of-file). Otherwise, the file is 2850 created. 2851 .RE 2852 2853 .sp 2854 .ne 2 2855 .na 2856 \fB\fB<>\fR\fIword\fR\fR 2857 .ad 2858 .RS 14n 2859 Open file \fIword\fR for reading and writing as standard input. 2860 .RE 2861 2862 .sp 2863 .ne 2 2864 .na 2865 \fB\fB<<\fR\fB[-]\fR\fIword\fR\fR 2866 .ad 2867 .RS 14n 2868 The shell input is read up to a line that is the same as \fIword\fR after any 2869 quoting has been removed, or to an end-of-file. No parameter substitution, 2870 command substitution, arithmetic substitution or file name generation is 2871 performed on \fIword\fR. The resulting document, called a \fBhere-document\fR, 2872 becomes the standard input. If any character of \fIword\fR is quoted, then no 2873 interpretation is placed upon the characters of the document. Otherwise, 2874 parameter expansion, command substitution, and arithmetic substitution occur, 2875 \fB\e\fRNEWLINE is ignored, and \fB\e\fR must be used to quote the characters 2876 \fB\e\fR, \fB$\fR, \fB`\fR\&. If \fB-\fR is appended to \fB<<\fR, then all 2877 leading tabs are stripped from \fIword\fR and from the document. If \fB#\fR is 2878 appended to \fB<<\fR, then leading SPACEs and TABs are stripped off the first 2879 line of the document and up to an equivalent indentation is stripped from the 2880 remaining lines and from \fIword\fR. A tab stop is assumed to occur at every 8 2881 columns for the purposes of determining the indentation. 2882 .RE 2883 2884 .sp 2885 .ne 2 2886 .na 2887 \fB\fB<<<\fR\fIword\fR\fR 2888 .ad 2889 .RS 14n 2890 A short form of here document in which \fIword\fR becomes the contents of the 2891 here-document after any parameter expansion, command substitution, and 2892 arithmetic substitution occur. 2893 .RE 2894 2895 .sp 2896 .ne 2 2897 .na 2898 \fB\fB<&\fR\fIdigit\fR\fR 2899 .ad 2900 .RS 14n 2901 The standard input is duplicated from file descriptor \fIdigit\fR, and 2902 similarly for the standard output using \fB>&\fR\fIdigit\fR. See \fBdup\fR(2). 2903 .RE 2904 2905 .sp 2906 .ne 2 2907 .na 2908 \fB\fB<&\fR\fIdigit\fR\fB-\fR\fR 2909 .ad 2910 .RS 14n 2911 The file descriptor specified by \fIdigit\fR is moved to standard input. 2912 Similarly for the standard output using \fB>&\fR\fIdigit\fR\fB-\fR. 2913 .RE 2914 2915 .sp 2916 .ne 2 2917 .na 2918 \fB\fB<&-\fR\fR 2919 .ad 2920 .RS 14n 2921 The standard input is closed. Similarly for the standard output using 2922 \fB>&-\fR. 2923 .RE 2924 2925 .sp 2926 .ne 2 2927 .na 2928 \fB\fB<&p\fR\fR 2929 .ad 2930 .RS 14n 2931 The input from the co-process is moved to standard input. 2932 .RE 2933 2934 .sp 2935 .ne 2 2936 .na 2937 \fB\fB>&p\fR\fR 2938 .ad 2939 .RS 14n 2940 The output to the co-process is moved to standard output. 2941 .RE 2942 2943 .sp 2944 .ne 2 2945 .na 2946 \fB\fB<#((\fR\fIexpr\fR\fB))\fR\fR 2947 .ad 2948 .RS 14n 2949 Evaluate arithmetic expression \fIexpr\fR and position file descriptor 0 to the 2950 resulting value bytes from the start of the file. The variables \fBCUR\fR and 2951 \fBEOF\fR evaluate to the current offset and end-of-file offset respectively 2952 when evaluating \fIexpr\fR. 2953 .RE 2954 2955 .sp 2956 .ne 2 2957 .na 2958 \fB\fB>#((\fR\fIexpr\fR\fB))\fR\fR 2959 .ad 2960 .RS 14n 2961 The same as \fB<#\fR except applies to file descriptor 1. 2962 .RE 2963 2964 .sp 2965 .ne 2 2966 .na 2967 \fB\fB<#\fR\fIpattern\fR\fR 2968 .ad 2969 .RS 14n 2970 Seek forward to the beginning of the next line containing pattern. 2971 .RE 2972 2973 .sp 2974 .ne 2 2975 .na 2976 \fB\fB<##\fR\fIpattern\fR\fR 2977 .ad 2978 .RS 14n 2979 The same as \fB<#\fR, except that the portion of the file that is skipped is 2980 copied to standard output. 2981 .RE 2982 2983 .sp 2984 .LP 2985 If one of the redirection operators is preceded by a digit, with no intervening 2986 space, then the file descriptor number referred to is that specified by the 2987 digit (instead of the default 0 or 1). If one of the redirection operators 2988 other than \fB>&-\fR and the \fB>#\fR and \fB<#\fR forms, is preceded by 2989 \fB{\fR\fIvarname\fR\fB}\fR with no intervening space, then a file descriptor 2990 number \fB> 10\fR is selected by the shell and stored in the variable 2991 \fIvarname\fR. If \fB>&-\fR or the any of the \fB>#\fR and \fB<#\fR forms is 2992 preceded by \fB{\fR\fIvarname\fR\fB}\fR the value of \fIvarname\fR defines the 2993 file descriptor to close or position. For example: 2994 .sp 2995 .in +2 2996 .nf 2997 \&... 2>&1 2998 .fi 2999 .in -2 3000 .sp 3001 3002 .sp 3003 .LP 3004 means file descriptor 2 is to be opened for writing as a duplicate of file 3005 descriptor 1 and 3006 .sp 3007 .in +2 3008 .nf 3009 exec [\fIn\fR]<\fIfile\fR 3010 .fi 3011 .in -2 3012 .sp 3013 3014 .sp 3015 .LP 3016 means open \fIfile\fR for reading and store the file descriptor number in 3017 variable \fIn\fR. The order in which redirections are specified is significant. 3018 The shell evaluates each redirection in terms of the (\fIfile_descriptor\fR, 3019 \fIfile\fR) association at the time of evaluation. For example: 3020 .sp 3021 .in +2 3022 .nf 3023 \&... 1>\fIfname\fR 2>&1 3024 .fi 3025 .in -2 3026 .sp 3027 3028 .sp 3029 .LP 3030 first associates file descriptor 1 with file \fIfname\fR. It then associates 3031 file descriptor 2 with the file associated with file descriptor 1, that is, 3032 \fIfname\fR. If the order of redirections were reversed, file descriptor 2 3033 would be associated with the terminal (assuming file descriptor 1 had been) and 3034 then file descriptor 1 would be associated with file \fIfname\fR. If a command 3035 is followed by \fB&\fR and job control is not active, the default standard 3036 input for the command is the empty file \fB/dev/null\fR. Otherwise, the 3037 environment for the execution of a command contains the file descriptors of the 3038 invoking shell as modified by input and output specifications. 3039 .SS "Environment" 3040 .LP 3041 The \fIenvironment\fR is a list of name-value pairs that is passed to an 3042 executed program in the same way as a normal argument list. See 3043 \fBenviron\fR(5). 3044 .sp 3045 .LP 3046 The names must be \fIidentifiers\fR and the values are character strings. The 3047 shell interacts with the environment in several ways. On invocation, the shell 3048 scans the environment and creates a variable for each name found, giving it the 3049 corresponding value and attributes and marking it \fBexport\fR. Executed 3050 commands inherit the environment. If the user modifies the values of these 3051 variables or creates new ones, using the \fBexport\fR or \fBtypeset\fR \fB-x\fR 3052 commands, they become part of the environment. The environment seen by any 3053 executed command is thus composed of any name-value pairs originally inherited 3054 by the shell, whose values can be modified by the current shell, plus any 3055 additions which must be noted in \fBexport\fR or \fBtypeset\fR \fB-x\fR 3056 commands. The environment for any simple-command or function can be augmented 3057 by prefixing it with one or more variable assignments. A variable assignment 3058 argument is a word of the form \fIidentifier\fR\fB=\fR\fIvalue\fR. Thus: 3059 .sp 3060 .in +2 3061 .nf 3062 TERM=450 cmd args 3063 .fi 3064 .in -2 3065 .sp 3066 3067 .sp 3068 .LP 3069 and 3070 .sp 3071 .in +2 3072 .nf 3073 (export TERM; TERM=450; cmd args) 3074 .fi 3075 .in -2 3076 .sp 3077 3078 .sp 3079 .LP 3080 are equivalent (as far as the execution of \fIcmd\fR is concerned except for 3081 special built-in commands listed in the \fBBuilt-Ins\fR section, those that are 3082 preceded with a dagger. If the obsolete \fB-k\fR option is set, all variable 3083 assignment arguments are placed in the environment, even if they occur after 3084 the command name. 3085 .sp 3086 .LP 3087 The following example first prints \fBa=b c\fR and then \fBc\fR: 3088 .sp 3089 .in +2 3090 .nf 3091 echo a=b c 3092 set -k 3093 echo a=b c 3094 .fi 3095 .in -2 3096 .sp 3097 3098 .sp 3099 .LP 3100 This feature is intended for use with scripts written for early versions of the 3101 shell and its use in new scripts is strongly discouraged. 3102 .SS "Functions" 3103 .LP 3104 For historical reasons, there are two ways to define functions, the 3105 \fBname()\fR syntax and the \fBfunction\fR \fBname\fR syntax. These are 3106 described in the \fBCommands\fR section of this manual page. 3107 .sp 3108 .LP 3109 Shell functions are read in and stored internally. Alias names are resolved 3110 when the function is read. Functions are executed like commands with the 3111 arguments passed as positional parameters. See the \fBExecution\fR section of 3112 this manual page for details. 3113 .sp 3114 .LP 3115 Functions defined by the \fBfunction\fR \fBname\fR syntax and called by name 3116 execute in the same process as the caller and share all files and present 3117 working directory with the caller. Traps caught by the caller are reset to 3118 their default action inside the function. A trap condition that is not caught 3119 or ignored by the function causes the function to terminate and the condition 3120 to be passed on to the caller. A trap on \fBEXIT\fR set inside a function is 3121 executed in the environment of the caller after the function completes. 3122 Ordinarily, variables are shared between the calling program and the function. 3123 However, the \fBtypeset\fR special built-in command used within a function 3124 defines local variables whose scope includes the current function. They can be 3125 passed to functions that they call in the variable assignment list that 3126 precedes the call or as arguments passed as name references. Errors within 3127 functions return control to the caller. 3128 .sp 3129 .LP 3130 Functions defined with the \fBname()\fR syntax and functions defined with the 3131 \fBfunction\fR \fBname\fR syntax that are invoked with the \fB\&.\fR special 3132 built-in are executed in the caller's environment and share all variables and 3133 traps with the caller. Errors within these function executions cause the script 3134 that contains them to abort. 3135 .sp 3136 .LP 3137 The special built-in command \fBreturn\fR is used to return from function 3138 calls. 3139 .sp 3140 .LP 3141 Function names can be listed with the \fB-f\fR or \fB+f\fR option of the 3142 \fBtypeset\fR special built-in command. The text of functions, when available, 3143 is also listed with \fB-f\fR. Functions can be undefined with the \fB-f\fR 3144 option of the \fBunset\fR special built-in command. 3145 .sp 3146 .LP 3147 Ordinarily, functions are unset when the shell executes a shell script. 3148 Functions that need to be defined across separate invocations of the shell 3149 should be placed in a directory and the \fBFPATH\fR variable should contain the 3150 name of this directory. They can also be specified in the \fBENV\fR file. 3151 .SS "Discipline Functions" 3152 .LP 3153 Each variable can have zero or more discipline functions associated with it. 3154 The shell initially understands the discipline names \fBget\fR, \fBset\fR, 3155 \fBappend\fR, and \fBunset\fR but on most systems others can be added at run 3156 time via the C programming interface extension provided by the \fBbuiltin\fR 3157 built-in utility. If the \fBget\fR discipline is defined for a variable, it is 3158 invoked whenever the specified variable is referenced. If the variable 3159 \fB\&.sh.value\fR is assigned a value inside the discipline function, the 3160 referenced variable is evaluated to this value instead. If the \fBset\fR 3161 discipline is defined for a variable, it is invoked whenever the specified 3162 variable is assigned a value. If the \fBappend\fR discipline is defined for a 3163 variable, it is invoked whenever a value is appended to the specified variable. 3164 The variable \fB\&.sh.value\fR is specified the value of the variable before 3165 invoking the discipline, and the variable is assigned the value of 3166 \fB\&.sh.value\fR after the discipline completes. If .\fBsh.value\fR is 3167 \fBunset\fR inside the discipline, then that value is unchanged. If the 3168 \fBunset\fR discipline is defined for a variable, it is invoked whenever the 3169 specified variable is unset. The variable is not unset unless it is unset 3170 explicitly from within this discipline function. 3171 .sp 3172 .LP 3173 The variable \fB\&.sh.name\fR contains the name of the variable for which the 3174 discipline function is called, \fB\&.sh.subscript\fR is the subscript of the 3175 variable, and \fB\&.sh.value\fR contains the value being assigned inside the 3176 \fBset\fR discipline function. For the \fBset\fR discipline, changing 3177 \fB\&.sh.value\fR changes the value that gets assigned. 3178 .SS "Jobs" 3179 .LP 3180 If the monitor option of the \fBset\fR command is turned on, an interactive 3181 shell associates a job with each pipeline. It keeps a table of current jobs, 3182 printed by the \fBjobs\fR command, and assigns them small integer numbers. When 3183 a job is started asynchronously with \fB&\fR, the shell prints a line which 3184 looks like: 3185 .sp 3186 .in +2 3187 .nf 3188 [1] 1234 3189 .fi 3190 .in -2 3191 .sp 3192 3193 .sp 3194 .LP 3195 indicating that the job which was started asynchronously was job number 1 and 3196 had one (top-level) process, whose process id was \fB1234\fR. 3197 .sp 3198 .LP 3199 If you are running a job and wish to stop it, CTRL-z sends a \fBSTOP\fR signal 3200 to the current job. The shell normally displays a message that the job has been 3201 stopped, and displays another prompt. You can then manipulate the state of this 3202 job, putting it in the background with the \fBbg\fR command, or run some other 3203 commands and then eventually bring the job back into the foreground with the 3204 foreground command \fBfg\fR. A CTRL-z takes effect immediately and is like an 3205 interrupt in that pending output and unread input are discarded when it is 3206 typed. 3207 .sp 3208 .LP 3209 A job being run in the background stops if it tries to read from the terminal. 3210 Background jobs are normally allowed to produce output, but this can be 3211 disabled by giving the command \fBsttytostop\fR. If you set this \fBtty\fR 3212 option, then background jobs stop when they try to produce output like they do 3213 when they try to read input. 3214 .sp 3215 .LP 3216 There are several ways to refer to jobs in the shell. A job can be referred to 3217 by the process id of any process of the job or by one of the following: 3218 .sp 3219 .ne 2 3220 .na 3221 \fB\fB%\fR\fInumber\fR\fR 3222 .ad 3223 .RS 12n 3224 The job with the specified number. 3225 .RE 3226 3227 .sp 3228 .ne 2 3229 .na 3230 \fB\fB%\fR\fIstring\fR\fR 3231 .ad 3232 .RS 12n 3233 Any job whose command line begins with \fIstring\fR. 3234 .RE 3235 3236 .sp 3237 .ne 2 3238 .na 3239 \fB\fB%?\fR\fIstring\fR\fR 3240 .ad 3241 .RS 12n 3242 Any job whose command line contains \fIstring\fR. 3243 .RE 3244 3245 .sp 3246 .ne 2 3247 .na 3248 \fB\fB%%\fR\fR 3249 .ad 3250 .RS 12n 3251 Current job. 3252 .RE 3253 3254 .sp 3255 .ne 2 3256 .na 3257 \fB\fB%+\fR\fR 3258 .ad 3259 .RS 12n 3260 Equivalent to \fB%%\fR. 3261 .RE 3262 3263 .sp 3264 .ne 2 3265 .na 3266 \fB\fB%-\fR\fR 3267 .ad 3268 .RS 12n 3269 Previous job. 3270 .RE 3271 3272 .sp 3273 .LP 3274 The shell learns immediately whenever a process changes state. It normally 3275 informs you whenever a job becomes blocked so that no further progress is 3276 possible, but only just before it prints a prompt. This is done so that it does 3277 not otherwise disturb your work. The notify option of the \fBset\fR command 3278 causes the shell to print these job change messages as soon as they occur. 3279 .sp 3280 .LP 3281 When the \fBmonitor\fR option is on, each background job that completes 3282 triggers any trap set for \fBCHLD\fR. 3283 .sp 3284 .LP 3285 When you try to leave the shell while jobs are running or stopped, you are 3286 warned that \fBYou have stopped(running) jobs.\fR You can use the \fBjobs\fR 3287 command to see what they are. If you immediately try to exit again, the shell 3288 does not warn you a second time, and the stopped jobs are terminated. When a 3289 login shell receives a \fBHUP\fR signal, it sends a \fBHUP\fR signal to each 3290 job that has not been disowned with the \fBdisown\fR built-in command. 3291 .SS "Signals" 3292 .LP 3293 The \fBINT\fR and \fBQUIT\fR signals for an invoked command are ignored if the 3294 command is followed by \fB&\fR and the \fBmonitor\fR option is not active. 3295 Otherwise, signals have the values inherited by the shell from its parent. See 3296 the \fBtrap\fR built-in command. 3297 .SS "Execution" 3298 .LP 3299 Each time a command is read, the substitutions are carried out. If the command 3300 name matches one of the ones in the \fBSpecial Built-in Commands\fR section of 3301 this manual page, it is executed within the current shell process. Next, the 3302 command name is checked to see if it matches a user defined function. If it 3303 does, the positional parameters are saved and then reset to the arguments of 3304 the function call. A function is also executed in the current shell process. 3305 When the function completes or issues a return, the positional parameter list 3306 is restored. For functions defined with the \fBfunction\fR \fBname\fR syntax, 3307 any trap set on \fBEXIT\fR within the function is executed. The exit value of a 3308 function is the value of the last command executed. If a command name is not a 3309 special built-in command or a user defined function, but it is one of the 3310 built-in commands, it is executed in the current shell process. 3311 .sp 3312 .LP 3313 The shell variable \fBPATH\fR defines the search path for the directory 3314 containing the command. Alternative directory names are separated by a colon 3315 (\fB:\fR). The default path is \fB/bin:/usr/bin:\fR, specifying \fB/bin\fR, 3316 \fB/usr/bin\fR, and the current directory in that order. The current directory 3317 can be specified by two or more adjacent colons, or by a colon at the beginning 3318 or end of the path list. If the command name contains a slash (\fB/\fR), the 3319 search path is not used. Otherwise, each directory in the path is searched for 3320 an executable file of the specified name that is not a directory. If found, and 3321 if the shell determines that there is a built-in version of a command 3322 corresponding to a specified pathname, this built-in is invoked in the current 3323 process. If found, and this directory is also contained in the value of the 3324 \fBFPATH\fR variable, then this file is loaded into the current shell 3325 environment as if it were the argument to the . command except that only preset 3326 aliases are expanded, and a function of the specified name is executed as 3327 described in this manual page. If not found, and the file \fB\&.paths\fR is 3328 found, and this file contains a line of the form \fBFPATH=\fR\fIpath\fR where 3329 \fIpath\fR is an existing directory, and this directory contains a file of the 3330 specified name, then this file is loaded into the current shell environment as 3331 if it were the argument to the \fB\&. special\fR built-in command and a 3332 function of the specified name is executed. Otherwise, if found, a process is 3333 created and an attempt is made to execute the command using \fBexec\fR(2). 3334 .sp 3335 .LP 3336 When an executable is found, the directory where it is found in is searched for 3337 a file named \fB\&.paths\fR. If this file is found and it contains a line of 3338 the form \fBBUILTIN_LIB=\fR\fIvalue\fR, the library named by \fIvalue\fR is 3339 searched for as if it were an option argument to \fBbuiltin -f\fR, and if it 3340 contains a built-in of the specified name this is executed instead of a command 3341 by this name. Otherwise, if this file is found and it contains a line of the 3342 form \fIname\fR\fB=\fR\fIvalue\fR in the first or second line, then the 3343 environment variable \fIname\fR is modified by prepending the directory 3344 specified by \fIvalue\fR to the directory list. If \fIvalue\fR is not an 3345 absolute directory, then it specifies a directory relative to the directory 3346 that the executable was found. If the environment variable \fIname\fR does not 3347 already exist it is added to the environment list for the specified command. 3348 .sp 3349 .LP 3350 If the file has execute permission but is not an \fBa.out\fR file, it is 3351 assumed to be a file containing shell commands. A separate shell is spawned to 3352 read it. All non-exported variables are removed in this case. If the shell 3353 command file doesn't have read permission, and/or if the \fBsetuid\fR and 3354 \fBsetgid\fR bits are set on the file, then the shell executes an agent whose 3355 job it is to set up the permissions and execute the shell with the shell 3356 command file passed down as an open file. A parenthesized command is executed 3357 in a sub-shell without removing non-exported variables. 3358 .SS "Command Re-entry" 3359 .LP 3360 The text of the last \fBHISTSIZE\fR (default 512) commands entered from a 3361 terminal device is saved in a history file. The file \fB$HOME/.sh_history\fR is 3362 used if the \fBHISTFILE\fR variable is not set or if the file it names is not 3363 writable. A shell can access the commands of all interactive shells which use 3364 the same named \fBHISTFILE\fR. The built-in command \fBhist\fR is used to list 3365 or edit a portion of this file. The portion of the file to be edited or listed 3366 can be selected by number or by giving the first character or characters of the 3367 command. A single command or range of commands can be specified. If you do not 3368 specify an editor program as an argument to \fBhist\fR then the value of the 3369 variable \fBHISTEDIT\fR is used. If \fBHISTEDIT\fR is unset, the obsolete 3370 variable \fBFCEDIT\fR is used. If \fBFCEDIT\fR is not defined, then 3371 \fB/bin/ed\fR is used. The edited commands are printed and executed again upon 3372 leaving the editor unless you quit without writing. The \fB-s\fR option (and in 3373 obsolete versions, the editor name \fB-\fR) is used to skip the editing phase 3374 and to re-execute the command. In this case a substitution parameter of the 3375 form \fIold\fR\fB=\fR\fInew\fRcan be used to modify the command before 3376 execution. For example, with the preset alias \fBr\fR, which is aliased to 3377 \fB\&'hist -s'\fR, typing \fB`r bad=good c'\fR re-executes the most recent 3378 command which starts with the letter \fBc\fR, replacing the first occurrence of 3379 the string bad with the string good. 3380 .SS "Inline Editing Options" 3381 .LP 3382 Normally, each command line entered from a terminal device is simply typed 3383 followed by a NEWLINE (RETURN or LINE FEED). If either the \fBemacs\fR, 3384 \fBgmacs\fR, or \fBvi\fR option is active, the user can edit the command line. 3385 To be in either of these edit modes set the corresponding option. An editing 3386 option is automatically selected each time the \fBVISUAL\fR or \fBEDITOR\fR 3387 variable is assigned a value ending in either of these option names. 3388 .sp 3389 .LP 3390 The editing features require that the user's terminal accept RETURN as carriage 3391 return without line feed and that a SPACE must overwrite the current character 3392 on the screen. 3393 .sp 3394 .LP 3395 Unless the \fBmultiline\fR option is on, the editing modes implement a concept 3396 where the user is looking through a window at the current line. The window 3397 width is the value of \fBCOLUMNS\fR if it is defined, otherwise \fB80\fR. If 3398 the window width is too small to display the prompt and leave at least 8 3399 columns to enter input, the prompt is truncated from the left. If the line is 3400 longer than the window width minus two, a mark is displayed at the end of the 3401 window to notify the user. As the cursor moves and reaches the window 3402 boundaries the window is centered about the cursor. The mark is a \fB>\fR 3403 (\fB<, *\fR) if the line extends on the right , left, or both sides of the 3404 window. 3405 .sp 3406 .LP 3407 The search commands in each edit mode provide access to the history file. Only 3408 strings are matched, not patterns, although a leading \fB^\fR in the string 3409 restricts the match to begin at the first character in the line. 3410 .sp 3411 .LP 3412 Each of the edit modes has an operation to list the files or commands that 3413 match a partially entered word. When applied to the first word on the line, or 3414 the first word after a \fB;\fR, \fB|\fR, \fB&\fR, or \fB(\fR, and the word does 3415 not begin with \fB~\fR or contain a \fB/\fR, the list of aliases, functions, 3416 and executable commands defined by the \fBPATH\fR variable that could match the 3417 partial word is displayed. Otherwise, the list of files that match the 3418 specified word is displayed. If the partially entered word does not contain any 3419 file expansion characters, a \fB*\fR is appended before generating these lists. 3420 After displaying the generated list, the input line is redrawn. These 3421 operations are called command name listing and file name listing, respectively. 3422 There are additional operations, referred to as command name completion and 3423 file name completion, which compute the list of matching commands or files, but 3424 instead of printing the list, replace the current word with a complete or 3425 partial match. For file name completion, if the match is unique, a \fB/\fR is 3426 appended if the file is a directory and a space is appended if the file is not 3427 a directory. Otherwise, the longest common prefix for all the matching files 3428 replaces the word. For command name completion, only the portion of the file 3429 names after the last \fB/\fR are used to find the longest command prefix. If 3430 only a single name matches this prefix, then the word is replaced with the 3431 command name followed by a space. When using a \fBTAB\fR for completion that 3432 does not yield a unique match, a subsequent TAB provides a numbered list of 3433 matching alternatives. A specific selection can be made by entering the 3434 selection number followed by a TAB. 3435 .SS "Key Bindings" 3436 .LP 3437 The \fBKEYBD\fR trap can be used to intercept keys as they are typed and change 3438 the characters that are actually seen by the shell. This trap is executed after 3439 each character (or sequence of characters when the first character is ESC) is 3440 entered while reading from a terminal. 3441 .sp 3442 .LP 3443 The variable \fB\&.sh.edchar\fR contains the character or character sequence 3444 which generated the trap. Changing the value of \fB\&.sh.edchar\fR in the trap 3445 action causes the shell to behave as if the new value were entered from the 3446 keyboard rather than the original value. The variable \fB\&.sh.edcol\fR is set 3447 to the input column number of the cursor at the time of the input. The variable 3448 \fB\&.sh.edmode\fR is set to \fBESC\fR when in \fBvi\fR insert mode and is null 3449 otherwise. By prepending \fB${.sh.editmode}\fR to a value assigned to 3450 \fB\&.sh.edchar\fR it causes the shell to change to control mode if it is not 3451 already in this mode. 3452 .sp 3453 .LP 3454 This trap is not invoked for characters entered as arguments to editing 3455 directives, or while reading input for a character search. 3456 .SS "\fBemacs\fR Editing Mode" 3457 .LP 3458 This mode is entered by enabling either the \fBemacs\fR or \fBgmacs\fR option. 3459 The only difference between these two modes is the way they handle \fB^T\fR. To 3460 edit, the user moves the cursor to the point needing correction and then 3461 inserts or deletes characters or words as needed. All the editing commands are 3462 control characters or escape sequences. The notation for control characters is 3463 caret (\fB^\fR) followed by the character. 3464 .sp 3465 .LP 3466 For example, \fB^F\fR is the notation for CTRL/F. This is entered by depressing 3467 \fBf\fR while holding down the CTRL (control) key. The SHIFT key is not 3468 depressed. (The notation \fB^?\fR indicates the DEL (delete) key.) 3469 .sp 3470 .LP 3471 The notation for escape sequences is \fBM-\fR followed by a character. For 3472 example, \fBM-f\fR (pronounced \fBMeta f\fR) is entered by depressing ESC 3473 (\fBASCII 033\fR) followed by \fBf\fR. \fBM-F\fR is the notation for ESC 3474 followed by \fBF\fR. 3475 .sp 3476 .LP 3477 All edit commands operate from any place on the line, not just at the 3478 beginning. The RETURN or the LINE FEED key is not entered after edit commands 3479 except when noted. 3480 .sp 3481 .ne 2 3482 .na 3483 \fB\fB^F\fR\fR 3484 .ad 3485 .RS 13n 3486 Move the cursor forward (right) one character. 3487 .RE 3488 3489 .sp 3490 .ne 2 3491 .na 3492 \fB\fBM-[C\fR\fR 3493 .ad 3494 .RS 13n 3495 Move the cursor forward (right) one character. 3496 .RE 3497 3498 .sp 3499 .ne 2 3500 .na 3501 \fB\fBM-f\fR\fR 3502 .ad 3503 .RS 13n 3504 Move the cursor forward one word. The \fBemacs\fR editor's idea of a word is a 3505 string of characters consisting of only letters, digits and underscores. 3506 .RE 3507 3508 .sp 3509 .ne 2 3510 .na 3511 \fB\fB^B\fR\fR 3512 .ad 3513 .RS 13n 3514 Move the cursor backward (left) one character. 3515 .RE 3516 3517 .sp 3518 .ne 2 3519 .na 3520 \fB\fBM-[D\fR\fR 3521 .ad 3522 .RS 13n 3523 Move the cursor backward (left) one character. 3524 .RE 3525 3526 .sp 3527 .ne 2 3528 .na 3529 \fB\fBM-b\fR\fR 3530 .ad 3531 .RS 13n 3532 Move the cursor backward one word. 3533 .RE 3534 3535 .sp 3536 .ne 2 3537 .na 3538 \fB\fB^A\fR\fR 3539 .ad 3540 .RS 13n 3541 Move the cursor to the beginning of the line. 3542 .RE 3543 3544 .sp 3545 .ne 2 3546 .na 3547 \fB\fBM-[H\fR\fR 3548 .ad 3549 .RS 13n 3550 Move the cursor to the beginning of the line. 3551 .RE 3552 3553 .sp 3554 .ne 2 3555 .na 3556 \fB\fB^E\fR\fR 3557 .ad 3558 .RS 13n 3559 Move the cursor to the end of the line. 3560 .RE 3561 3562 .sp 3563 .ne 2 3564 .na 3565 \fB\fBM-[Y\fR\fR 3566 .ad 3567 .RS 13n 3568 Move the cursor to the end of line. 3569 .RE 3570 3571 .sp 3572 .ne 2 3573 .na 3574 \fB\fB^]\fR\fIchar\fR\fR 3575 .ad 3576 .RS 13n 3577 Move the cursor forward to the character \fIchar\fR on the current line. 3578 .RE 3579 3580 .sp 3581 .ne 2 3582 .na 3583 \fB\fBM-^]\fR\fIchar\fR\fR 3584 .ad 3585 .RS 13n 3586 Move the cursor backwards to the character \fIchar\fR on the current line. 3587 .RE 3588 3589 .sp 3590 .ne 2 3591 .na 3592 \fB\fB^X^X\fR\fR 3593 .ad 3594 .RS 13n 3595 Interchange the cursor and the mark. 3596 .RE 3597 3598 .sp 3599 .ne 2 3600 .na 3601 \fB\fIerase\fR\fR 3602 .ad 3603 .RS 13n 3604 Delete the previous character. The user-defined erase character is defined by 3605 the \fBstty\fR(1) command, and is usually \fB^H\fR or \fB#\fR. 3606 .RE 3607 3608 .sp 3609 .ne 2 3610 .na 3611 \fB\fIlnext\fR\fR 3612 .ad 3613 .RS 13n 3614 Removes the next character's editing features. The user-defined literal next 3615 character is defined by the \fBstty\fR(1) command, or is \fB^V\fR if not 3616 defined. 3617 .RE 3618 3619 .sp 3620 .ne 2 3621 .na 3622 \fB\fB^D\fR\fR 3623 .ad 3624 .RS 13n 3625 Delete the current character. 3626 .RE 3627 3628 .sp 3629 .ne 2 3630 .na 3631 \fB\fBM-d\fR\fR 3632 .ad 3633 .RS 13n 3634 Delete the current word. 3635 .RE 3636 3637 .sp 3638 .ne 2 3639 .na 3640 \fB\fBM-^H\fR\fR 3641 .ad 3642 .RS 13n 3643 MetaBACKSPACE. Delete the previous word. 3644 .RE 3645 3646 .sp 3647 .ne 2 3648 .na 3649 \fB\fBM-h\fR\fR 3650 .ad 3651 .RS 13n 3652 Delete the previous word. 3653 .RE 3654 3655 .sp 3656 .ne 2 3657 .na 3658 \fB\fBM-^?\fR\fR 3659 .ad 3660 .RS 13n 3661 MetaDEL. Delete the previous word. If your interrupt character is \fB^?\fR 3662 (DEL, the default), this command does not work. 3663 .RE 3664 3665 .sp 3666 .ne 2 3667 .na 3668 \fB\fB^T\fR\fR 3669 .ad 3670 .RS 13n 3671 Transpose the current character with the previous character, and advance the 3672 cursor in \fBemacs\fR mode. Transpose two previous characters in \fBgmacs\fR 3673 mode. 3674 .RE 3675 3676 .sp 3677 .ne 2 3678 .na 3679 \fB\fB^C\fR\fR 3680 .ad 3681 .RS 13n 3682 Capitalize the current character. 3683 .RE 3684 3685 .sp 3686 .ne 2 3687 .na 3688 \fB\fBM-c\fR\fR 3689 .ad 3690 .RS 13n 3691 Capitalize the current word. 3692 .RE 3693 3694 .sp 3695 .ne 2 3696 .na 3697 \fB\fBM-l\fR\fR 3698 .ad 3699 .RS 13n 3700 Change the current word to lower case. 3701 .RE 3702 3703 .sp 3704 .ne 2 3705 .na 3706 \fB\fB^K\fR\fR 3707 .ad 3708 .RS 13n 3709 Delete from the cursor to the end of the line. If preceded by a numerical 3710 parameter whose value is less than the current cursor position, delete from 3711 specified position up to the cursor. If preceded by a numerical parameter whose 3712 value is greater than the current cursor position, then delete from cursor up 3713 to specified cursor position. 3714 .RE 3715 3716 .sp 3717 .ne 2 3718 .na 3719 \fB\fB^W\fR\fR 3720 .ad 3721 .RS 13n 3722 Kill from the cursor to the mark. 3723 .RE 3724 3725 .sp 3726 .ne 2 3727 .na 3728 \fB\fBM-p\fR\fR 3729 .ad 3730 .RS 13n 3731 Push the region from the cursor to the mark on the stack. 3732 .RE 3733 3734 .sp 3735 .ne 2 3736 .na 3737 \fB\fIkill\fR\fR 3738 .ad 3739 .RS 13n 3740 Kill the entire current line. The user-defined kill character is defined by the 3741 \fBstty\fR(1) command, usually a \fB^G\fR or \fB@\fR. If two kill characters 3742 are entered in succession, all kill characters from then on cause a line feed. 3743 This is useful when using paper terminals. 3744 .RE 3745 3746 .sp 3747 .ne 2 3748 .na 3749 \fB\fB^Y\fR\fR 3750 .ad 3751 .RS 13n 3752 Restore the last item removed from line. Yank the item back to the line. 3753 .RE 3754 3755 .sp 3756 .ne 2 3757 .na 3758 \fB\fB^L\fR\fR 3759 .ad 3760 .RS 13n 3761 Line feed and print the current line. 3762 .RE 3763 3764 .sp 3765 .ne 2 3766 .na 3767 \fB\fBM-^L\fR\fR 3768 .ad 3769 .RS 13n 3770 Clear the screen. 3771 .RE 3772 3773 .sp 3774 .ne 2 3775 .na 3776 \fB\fB^@\fR\fR 3777 .ad 3778 .RS 13n 3779 Null character. Set mark. 3780 .RE 3781 3782 .sp 3783 .ne 2 3784 .na 3785 \fB\fBM-\fR\fIspace\fR\fR 3786 .ad 3787 .RS 13n 3788 MetaSPACE. Set the mark. 3789 .RE 3790 3791 .sp 3792 .ne 2 3793 .na 3794 \fB\fB^J\fR\fR 3795 .ad 3796 .RS 13n 3797 New line. Execute the current line. 3798 .RE 3799 3800 .sp 3801 .ne 2 3802 .na 3803 \fB\fB^M\fR\fR 3804 .ad 3805 .RS 13n 3806 Return. Execute the current line. 3807 .RE 3808 3809 .sp 3810 .ne 2 3811 .na 3812 \fB\fBEOF\fR\fR 3813 .ad 3814 .RS 13n 3815 End-of-file character, normally \fB^D\fR, is processed as an \fBend-of-file\fR 3816 only if the current line is null. 3817 .RE 3818 3819 .sp 3820 .ne 2 3821 .na 3822 \fB\fB^P\fR\fR 3823 .ad 3824 .RS 13n 3825 Fetch the previous command. Each time \fB^P\fR is entered the previous command 3826 back in time is accessed. Moves back one line when it is not on the first line 3827 of a multi-line command. 3828 .RE 3829 3830 .sp 3831 .ne 2 3832 .na 3833 \fB\fBM-[A\fR\fR 3834 .ad 3835 .RS 13n 3836 Equivalent to \fB^P\fR. 3837 .RE 3838 3839 .sp 3840 .ne 2 3841 .na 3842 \fB\fBM-<\fR\fR 3843 .ad 3844 .RS 13n 3845 Fetch the least recent (oldest) history line. 3846 .RE 3847 3848 .sp 3849 .ne 2 3850 .na 3851 \fB\fBM->\fR\fR 3852 .ad 3853 .RS 13n 3854 Fetch the most recent (youngest) history line. 3855 .RE 3856 3857 .sp 3858 .ne 2 3859 .na 3860 \fB\fB^N\fR\fR 3861 .ad 3862 .RS 13n 3863 Fetch the next command line. Each time \fB^N\fR is entered the next command 3864 line forward in time is accessed. 3865 .RE 3866 3867 .sp 3868 .ne 2 3869 .na 3870 \fB\fBM-[B\fR\fR 3871 .ad 3872 .RS 13n 3873 Equivalent to \fB^N\fR. 3874 .RE 3875 3876 .sp 3877 .ne 2 3878 .na 3879 \fB\fB^R\fR\fIstring\fR\fR 3880 .ad 3881 .RS 13n 3882 Reverse search history for a previous command line containing \fIstring\fR. If 3883 a parameter of zero is specified, the search is forward. \fIstring\fR is 3884 terminated by a RETURN or NEWLINE. If string is preceded by a \fB^\fR, the 3885 matched line must begin with \fIstring\fR. If \fIstring\fR is omitted, then the 3886 next command line containing the most recent \fIstring\fR is accessed. In this 3887 case a parameter of zero reverses the direction of the search. 3888 .RE 3889 3890 .sp 3891 .ne 2 3892 .na 3893 \fB\fB^O\fR\fR 3894 .ad 3895 .RS 13n 3896 Operate. Execute the current line and fetch the next line relative to current 3897 line from the history file. 3898 .RE 3899 3900 .sp 3901 .ne 2 3902 .na 3903 \fB\fBM-\fR\fIdigits\fR\fR 3904 .ad 3905 .RS 13n 3906 Escape. Define numeric parameter. The digits are taken as a parameter to the 3907 next command. The commands that accept a parameter are: \fB^F\fR, \fB^B\fR, 3908 \fBERASE\fR, \fB^C\fR, \fB^D\fR, \fB^K\fR, \fB^R\fR, \fB^P\fR, \fB^N\fR, 3909 \fB^]\fR, \fBM-.\fR, \fBM-\fR, \fBM-^]\fR, \fBM-_\fR, \fBM-=\fR, \fBM-b\fR, 3910 \fBM-c\fR, \fBM-d\fR, \fBM-f\fR, \fBM-h\fR, \fBM-l\fR, and \fBM-^H\fR. 3911 .RE 3912 3913 .sp 3914 .ne 2 3915 .na 3916 \fB\fBM-\fR\fIletter\fR\fR 3917 .ad 3918 .RS 13n 3919 Soft-key. Search the alias list for an alias by the name \fIletter\fR. If an 3920 alias of \fIletter\fR is defined, insert its value on the input queue. 3921 \fIletter\fR must not be one of the metafunctions in this section. 3922 .RE 3923 3924 .sp 3925 .ne 2 3926 .na 3927 \fB\fBM-[\fR\fIletter\fR\fR 3928 .ad 3929 .RS 13n 3930 Soft key. Search the alias list for an alias by the name \fIletter\fR. If an 3931 alias of this name is defined, insert its value on the input queue. This can be 3932 used to program function keys on many terminals. 3933 .RE 3934 3935 .sp 3936 .ne 2 3937 .na 3938 \fB\fBM-.\fR\fR 3939 .ad 3940 .RS 13n 3941 The last word of the previous command is inserted on the line. If preceded by a 3942 numeric parameter, the value of this parameter determines which word to insert 3943 rather than the last word. 3944 .RE 3945 3946 .sp 3947 .ne 2 3948 .na 3949 \fB\fBM-_\fR\fR 3950 .ad 3951 .RS 13n 3952 Same as \fBM-.\fR. 3953 .RE 3954 3955 .sp 3956 .ne 2 3957 .na 3958 \fB\fBM-*\fR\fR 3959 .ad 3960 .RS 13n 3961 Attempt filename generation on the current word. As asterisk is appended if the 3962 word does not match any file or contain any special pattern characters. 3963 .RE 3964 3965 .sp 3966 .ne 2 3967 .na 3968 \fB\fBM-\fRESC\fR 3969 .ad 3970 .RS 13n 3971 Command or file name completion as described in this manual page. 3972 .RE 3973 3974 .sp 3975 .ne 2 3976 .na 3977 \fB\fB^I\fRTAB\fR 3978 .ad 3979 .RS 13n 3980 Attempts command or file name completion as described in this manual page. If a 3981 partial completion occurs, repeating this behaves as if \fBM-=\fR were entered. 3982 If no match is found or entered after SPACE, a TAB is inserted. 3983 .RE 3984 3985 .sp 3986 .ne 2 3987 .na 3988 \fB\fBM-=\fR\fR 3989 .ad 3990 .RS 13n 3991 If not preceded by a numeric parameter, generates the list of matching commands 3992 or file names as described in this manual page. Otherwise, the word under the 3993 cursor is replaced by the item corresponding to the value of the numeric 3994 parameter from the most recently generated command or file list. If the cursor 3995 is not on a word, the word is inserted instead. 3996 .RE 3997 3998 .sp 3999 .ne 2 4000 .na 4001 \fB\fB^U\fR\fR 4002 .ad 4003 .RS 13n 4004 Multiply parameter of next command by \fB4\fR. 4005 .RE 4006 4007 .sp 4008 .ne 2 4009 .na 4010 \fB\fB\e\fR\fR 4011 .ad 4012 .RS 13n 4013 Escape the next character. Editing characters, the user's erase, kill and 4014 interrupt (normally \fB^?\fR) characters can be entered in a command line or in 4015 a search string if preceded by a \fB\e\fR\&. The \fB\e\fR removes the next 4016 character's editing features, if any. 4017 .RE 4018 4019 .sp 4020 .ne 2 4021 .na 4022 \fB\fBM-^V\fR\fR 4023 .ad 4024 .RS 13n 4025 Display the version of the shell. 4026 .RE 4027 4028 .sp 4029 .ne 2 4030 .na 4031 \fB\fBM-#\fR\fR 4032 .ad 4033 .RS 13n 4034 If the line does not begin with a \fB#\fR, a \fB#\fR is inserted at the 4035 beginning of the line and after each NEWLINE, and the line is entered. This 4036 causes a comment to be inserted in the history file. If the line begins with a 4037 \fB#\fR, the \fB#\fR is deleted and one \fB#\fR after each NEWLINE is also 4038 deleted. 4039 .RE 4040 4041 .SS "\fBvi\fR Editing Mode" 4042 .LP 4043 There are two typing modes. Initially, when you enter a command you are in the 4044 input mode. To edit, the user enters control mode by typing ESC (033) and moves 4045 the cursor to the point needing correction and then inserts or deletes 4046 characters or words as needed. Most control commands accept an optional repeat 4047 \fIcount\fR prior to the command. 4048 .sp 4049 .LP 4050 When in vi mode on most systems, canonical processing is initially enabled and 4051 the command is echoed again if the speed is 1200 baud or greater and it 4052 contains any control characters or less than one second has elapsed since the 4053 prompt was printed. The ESC character terminates canonical processing for the 4054 remainder of the command and the user can then modify the command line. This 4055 scheme has the advantages of canonical processing with the type-ahead echoing 4056 of raw mode. 4057 .sp 4058 .LP 4059 If the option \fBviraw\fR is also set, the terminal is always have canonical 4060 processing disabled. This mode is implicit for systems that do not support two 4061 alternate end of line delimiters, and might be helpful for certain terminals. 4062 .SS "Input Edit Commands" 4063 .LP 4064 By default the editor is in input mode. 4065 .sp 4066 .LP 4067 The following input edit commands are supported: 4068 .sp 4069 .ne 2 4070 .na 4071 \fBERASE\fR 4072 .ad 4073 .RS 10n 4074 User defined erase character as defined by the \fBstty\fR command, usually 4075 \fB^H\fR or \fB#\fR. Delete previous character. 4076 .RE 4077 4078 .sp 4079 .ne 2 4080 .na 4081 \fB\fB^W\fR\fR 4082 .ad 4083 .RS 10n 4084 Delete the previous blank separated word. On some systems the \fBviraw\fR 4085 option might be required for this to work. 4086 .RE 4087 4088 .sp 4089 .ne 2 4090 .na 4091 \fBEOF\fR 4092 .ad 4093 .RS 10n 4094 As the first character of the line causes the shell to terminate unless the 4095 \fBignoreeof\fR option is set. Otherwise this character is ignored. 4096 .RE 4097 4098 .sp 4099 .ne 2 4100 .na 4101 \fB\fIlnext\fR\fR 4102 .ad 4103 .RS 10n 4104 User defined literal next character as defined by the \fBstty\fR(1) or \fB^V\fR 4105 if not defined. Removes the next character's editing features, if any. On some 4106 systems the \fBviraw\fR option might be required for this to work. 4107 .RE 4108 4109 .sp 4110 .ne 2 4111 .na 4112 \fB\fB\e\fR\fR 4113 .ad 4114 .RS 10n 4115 Escape the next ERASE or KILL character. 4116 .RE 4117 4118 .sp 4119 .ne 2 4120 .na 4121 \fB\fB^I\fR TAB\fR 4122 .ad 4123 .RS 10n 4124 Attempts command or file name completion as described in this manual page and 4125 returns to input mode. If a partial completion occurs, repeating this behaves 4126 as if \fB=\fR were entered from control mode. If no match is found or entered 4127 after SPACE, a TAB is inserted. 4128 .RE 4129 4130 .SS "Motion Edit Commands" 4131 .LP 4132 The motion edit commands move the cursor. 4133 .sp 4134 .LP 4135 The following motion edit commands are supported: 4136 .sp 4137 .ne 2 4138 .na 4139 \fB\fB[\fR\fIcount\fR\fB]l\fR\fR 4140 .ad 4141 .RS 13n 4142 Move the cursor forward (right) one character. 4143 .RE 4144 4145 .sp 4146 .ne 2 4147 .na 4148 \fB\fB[\fR\fIcount\fR\fB][C\fR\fR 4149 .ad 4150 .RS 13n 4151 Move the cursor forward (right) one character. 4152 .RE 4153 4154 .sp 4155 .ne 2 4156 .na 4157 \fB\fB[\fR\fIcount\fR\fB]w\fR\fR 4158 .ad 4159 .RS 13n 4160 Move the cursor forward one alphanumeric word. 4161 .RE 4162 4163 .sp 4164 .ne 2 4165 .na 4166 \fB\fB[\fR\fIcount\fR\fB]W\fR\fR 4167 .ad 4168 .RS 13n 4169 Move the cursor to the beginning of the next word that follows a blank. 4170 .RE 4171 4172 .sp 4173 .ne 2 4174 .na 4175 \fB\fB[\fR\fIcount\fR\fB]e\fR\fR 4176 .ad 4177 .RS 13n 4178 Move the cursor to the end of the word. 4179 .RE 4180 4181 .sp 4182 .ne 2 4183 .na 4184 \fB\fB[\fR\fIcount\fR\fB]E\fR\fR 4185 .ad 4186 .RS 13n 4187 Move the cursor to the end of the current blank delimited word. 4188 .RE 4189 4190 .sp 4191 .ne 2 4192 .na 4193 \fB\fB[\fR\fIcount\fR\fB]h\fR\fR 4194 .ad 4195 .RS 13n 4196 Move the cursor backward (left) one character. 4197 .RE 4198 4199 .sp 4200 .ne 2 4201 .na 4202 \fB\fB[\fR\fIcount\fR\fB][D\fR\fR 4203 .ad 4204 .RS 13n 4205 Move the cursor backward (left) one character. 4206 .RE 4207 4208 .sp 4209 .ne 2 4210 .na 4211 \fB\fB[\fR\fIcount\fR\fB]b\fR\fR 4212 .ad 4213 .RS 13n 4214 Move the cursor backward one word. 4215 .RE 4216 4217 .sp 4218 .ne 2 4219 .na 4220 \fB\fB[\fR\fIcount\fR\fB]B\fR\fR 4221 .ad 4222 .RS 13n 4223 Move the cursor to the preceding blank separated word. 4224 .RE 4225 4226 .sp 4227 .ne 2 4228 .na 4229 \fB\fB[\fR\fIcount\fR\fB]|\fR\fR 4230 .ad 4231 .RS 13n 4232 Move the cursor to column \fIcount\fR. 4233 .RE 4234 4235 .sp 4236 .ne 2 4237 .na 4238 \fB\fB[\fR\fIcount\fR\fB]f\fR\fIc\fR\fR 4239 .ad 4240 .RS 13n 4241 Find the next character \fIc\fR in the current line. 4242 .RE 4243 4244 .sp 4245 .ne 2 4246 .na 4247 \fB\fB[\fR\fIcount\fR\fB]F\fR\fIc\fR\fR 4248 .ad 4249 .RS 13n 4250 Find the previous character \fIc\fR in the current line. 4251 .RE 4252 4253 .sp 4254 .ne 2 4255 .na 4256 \fB\fB[\fR\fIcount\fR\fB]t\fR\fIC\fR\fR 4257 .ad 4258 .RS 13n 4259 Equivalent to \fBf\fR followed by \fBh\fR. 4260 .RE 4261 4262 .sp 4263 .ne 2 4264 .na 4265 \fB\fB[\fR\fIcount\fR\fB]T\fR\fIc\fR\fR 4266 .ad 4267 .RS 13n 4268 Equivalent to \fBF\fR followed by \fBl\fR. 4269 .RE 4270 4271 .sp 4272 .ne 2 4273 .na 4274 \fB\fB[\fR\fIcount\fR\fB];\fR\fR 4275 .ad 4276 .RS 13n 4277 Repeat \fIcount\fR times the last single character find command: \fBf\fR, 4278 \fBF\fR, \fBt,\fR or \fBT\fR. 4279 .RE 4280 4281 .sp 4282 .ne 2 4283 .na 4284 \fB\fB[\fR\fIcount\fR\fB],\fR\fR 4285 .ad 4286 .RS 13n 4287 Reverse the last single character find command \fIcount\fR times. 4288 .RE 4289 4290 .sp 4291 .ne 2 4292 .na 4293 \fB\fB0\fR\fR 4294 .ad 4295 .RS 13n 4296 Move the cursor to the start of line. 4297 .RE 4298 4299 .sp 4300 .ne 2 4301 .na 4302 \fB\fB^\fR\fR 4303 .ad 4304 .RS 13n 4305 Move the cursor to start of line. 4306 .RE 4307 4308 .sp 4309 .ne 2 4310 .na 4311 \fB\fB[H\fR\fR 4312 .ad 4313 .RS 13n 4314 Move the cursor to the first non-blank character in the line. 4315 .RE 4316 4317 .sp 4318 .ne 2 4319 .na 4320 \fB\fB$\fR\fR 4321 .ad 4322 .RS 13n 4323 Move the cursor to the end of the line. 4324 .RE 4325 4326 .sp 4327 .ne 2 4328 .na 4329 \fB\fB[Y\fR\fR 4330 .ad 4331 .RS 13n 4332 Move the cursor to the end of the line. 4333 .RE 4334 4335 .sp 4336 .ne 2 4337 .na 4338 \fB\fB%\fR\fR 4339 .ad 4340 .RS 13n 4341 Moves to balancing \fB(\fR, \fB)\fR, \fB{\fR, \fB}\fR, \fB[\fR, or \fB]\fR. If 4342 cursor is not on one of the characters described in this section, the remainder 4343 of the line is searched for the first occurrence of one of the characters 4344 first. 4345 .RE 4346 4347 .SS "Search Edit Commands" 4348 .LP 4349 The search edit commands access your command history. 4350 .sp 4351 .LP 4352 The following search edit commands are supported: 4353 .sp 4354 .ne 2 4355 .na 4356 \fB\fB[\fR\fIcount\fR\fB]k\fR\fR 4357 .ad 4358 .RS 13n 4359 Fetch the previous command. Each time \fBk\fR is entered, the previous command 4360 back in time is accessed. 4361 .RE 4362 4363 .sp 4364 .ne 2 4365 .na 4366 \fB\fB[\fR\fIcount\fR\fB]-\fR\fR 4367 .ad 4368 .RS 13n 4369 Fetch the previous command. Each time \fBk\fR is entered, the previous command 4370 back in time is accessed. 4371 .sp 4372 Equivalent to \fBk\fR. 4373 .RE 4374 4375 .sp 4376 .ne 2 4377 .na 4378 \fB\fB[\fR\fIcount\fR\fB][A\fR\fR 4379 .ad 4380 .RS 13n 4381 Fetch the previous command. Each time \fBk\fR is entered, the previous command 4382 back in time is accessed. 4383 .sp 4384 Equivalent to \fBk\fR. 4385 .RE 4386 4387 .sp 4388 .ne 2 4389 .na 4390 \fB\fB[\fR\fIcount\fR\fB]j\fR\fR 4391 .ad 4392 .RS 13n 4393 Fetch the next command. Each time \fBj\fR is entered, the next command forward 4394 in time is accessed. 4395 .RE 4396 4397 .sp 4398 .ne 2 4399 .na 4400 \fB\fB[\fR\fIcount\fR\fB]+\fR\fR 4401 .ad 4402 .RS 13n 4403 Fetch the next command. Each time \fBj\fR is entered, the next command forward 4404 in time is accessed. 4405 .sp 4406 Equivalent to \fBj\fR. 4407 .RE 4408 4409 .sp 4410 .ne 2 4411 .na 4412 \fB\fB[\fR\fIcount\fR\fB][B\fR\fR 4413 .ad 4414 .RS 13n 4415 Fetch the next command. Each time \fBj\fR is entered, the next command forward 4416 in time is accessed. 4417 .sp 4418 Equivalent to \fBj\fR. 4419 .RE 4420 4421 .sp 4422 .ne 2 4423 .na 4424 \fB\fB[\fR\fIcount\fR\fB]G\fR\fR 4425 .ad 4426 .RS 13n 4427 Fetch command number \fIcount\fR. The default is the least recent history 4428 command. 4429 .RE 4430 4431 .sp 4432 .ne 2 4433 .na 4434 \fB\fB/\fR\fIstring\fR\fR 4435 .ad 4436 .RS 13n 4437 Search backward through history for a previous command containing \fIstring\fR. 4438 \fIstring\fR is terminated by a RETURN or NEWLINE. If string is preceded by a 4439 \fB^\fR, the matched line must begin with \fIstring\fR. If \fIstring\fR is 4440 null, the previous string is used. 4441 .RE 4442 4443 .sp 4444 .ne 2 4445 .na 4446 \fB\fB?\fR\fIstring\fR\fR 4447 .ad 4448 .RS 13n 4449 Search forward through history for a previous command containing \fIstring\fR. 4450 \fIstring\fR is terminated by a RETURN or NEWLINE. If string is preceded by a 4451 \fB^\fR, the matched line must begin with \fIstring\fR. If \fIstring\fR is 4452 null, the previous string is used. 4453 .sp 4454 Same as \fI/\fR except that search is in the forward direction. 4455 .RE 4456 4457 .sp 4458 .ne 2 4459 .na 4460 \fB\fBn\fR\fR 4461 .ad 4462 .RS 13n 4463 Search in the backwards direction for the next match of the last pattern to 4464 \fI/\fR or \fI?\fR commands. 4465 .RE 4466 4467 .sp 4468 .ne 2 4469 .na 4470 \fB\fBN\fR\fR 4471 .ad 4472 .RS 13n 4473 Search in the forward direction for next match of the last pattern to \fI/\fR 4474 or \fI?\fR. 4475 .RE 4476 4477 .SS "Text Modification Edit Commands" 4478 .LP 4479 The following commands modify the line: 4480 .sp 4481 .ne 2 4482 .na 4483 \fB\fBa\fR\fR 4484 .ad 4485 .RS 19n 4486 Enter input mode and enter text after the current character. 4487 .RE 4488 4489 .sp 4490 .ne 2 4491 .na 4492 \fB\fBA\fR\fR 4493 .ad 4494 .RS 19n 4495 Append text to the end of the line. Equivalent to \fB$a\fR. 4496 .RE 4497 4498 .sp 4499 .ne 2 4500 .na 4501 \fB\fB[\fR\fIcount\fR\fB]c\fR\fImotion\fR\fR 4502 .ad 4503 .br 4504 .na 4505 \fB\fBc[\fR\fIcount\fR\fB]\fR\fImotion\fR\fR 4506 .ad 4507 .RS 19n 4508 Delete current character through the character that \fImotion\fR would move the 4509 cursor to and enter input mode. If \fImotion\fR is \fBc\fR, the entire line is 4510 deleted and input mode entered. 4511 .RE 4512 4513 .sp 4514 .ne 2 4515 .na 4516 \fB\fBC\fR\fR 4517 .ad 4518 .RS 19n 4519 Delete the current character through the end of line and enter input mode. 4520 Equivalent to \fBc$\fR. 4521 .RE 4522 4523 .sp 4524 .ne 2 4525 .na 4526 \fB\fBS\fR\fR 4527 .ad 4528 .RS 19n 4529 Equivalent to \fBcc\fR. 4530 .RE 4531 4532 .sp 4533 .ne 2 4534 .na 4535 \fB\fB[\fR\fIcount\fR\fB]s\fR\fR 4536 .ad 4537 .RS 19n 4538 Replace characters under the cursor in input mode. 4539 .RE 4540 4541 .sp 4542 .ne 2 4543 .na 4544 \fB\fBD[\fR\fIcount\fR\fB]d\fR\fImotion\fR\fR 4545 .ad 4546 .RS 19n 4547 Delete the current character through the end of line. Equivalent to d$. 4548 .RE 4549 4550 .sp 4551 .ne 2 4552 .na 4553 \fB\fBd[\fR\fIcount\fR\fB]\fR\fImotion\fR\fR 4554 .ad 4555 .RS 19n 4556 Delete current character through the character that \fImotion\fR would move to. 4557 If \fImotion\fR is d , the entire line is deleted. 4558 .RE 4559 4560 .sp 4561 .ne 2 4562 .na 4563 \fB\fBi\fR\fR 4564 .ad 4565 .RS 19n 4566 Enter input mode and insert text before the current character. 4567 .RE 4568 4569 .sp 4570 .ne 2 4571 .na 4572 \fB\fBI\fR\fR 4573 .ad 4574 .RS 19n 4575 Insert text before the beginning of the line. Equivalent to \fB0i\fR. 4576 .RE 4577 4578 .sp 4579 .ne 2 4580 .na 4581 \fB\fB[\fR\fIcount\fR\fB]P\fR\fR 4582 .ad 4583 .RS 19n 4584 Place the previous text modification before the cursor. 4585 .RE 4586 4587 .sp 4588 .ne 2 4589 .na 4590 \fB\fB[\fR\fIcount\fR\fB]p\fR\fR 4591 .ad 4592 .RS 19n 4593 Place the previous text modification after the cursor. 4594 .RE 4595 4596 .sp 4597 .ne 2 4598 .na 4599 \fB\fBR\fR\fR 4600 .ad 4601 .RS 19n 4602 Enter input mode and replace characters on the screen with characters you type 4603 overlay fashion. 4604 .RE 4605 4606 .sp 4607 .ne 2 4608 .na 4609 \fB\fB[\fR\fIcount\fR\fB]r\fR\fIc\fR\fR 4610 .ad 4611 .RS 19n 4612 Replace the \fIcount\fR characters starting at the current cursor position with 4613 \fIc\fR, and advance the cursor. 4614 .RE 4615 4616 .sp 4617 .ne 2 4618 .na 4619 \fB\fB[\fR\fIcount\fR\fB]x\fR\fR 4620 .ad 4621 .RS 19n 4622 Delete current character. 4623 .RE 4624 4625 .sp 4626 .ne 2 4627 .na 4628 \fB\fB[\fIcount\fR]X\fR\fR 4629 .ad 4630 .RS 19n 4631 Delete preceding character. 4632 .RE 4633 4634 .sp 4635 .ne 2 4636 .na 4637 \fB\fB[\fIcount\fR].\fR\fR 4638 .ad 4639 .RS 19n 4640 Repeat the previous text modification command. 4641 .RE 4642 4643 .sp 4644 .ne 2 4645 .na 4646 \fB\fB[\fIcount\fR]~\fR\fR 4647 .ad 4648 .RS 19n 4649 Invert the case of the \fIcount\fR characters starting at the current cursor 4650 position and advance the cursor. 4651 .RE 4652 4653 .sp 4654 .ne 2 4655 .na 4656 \fB\fB[\fIcount\fR]_\fR\fR 4657 .ad 4658 .RS 19n 4659 Causes the \fIcount\fR word of the previous command to be appended and input 4660 mode entered. The last word is used if \fIcount\fR is omitted. 4661 .RE 4662 4663 .sp 4664 .ne 2 4665 .na 4666 \fB\fB*\fR\fR 4667 .ad 4668 .RS 19n 4669 Causes an \fB*\fR to be appended to the current word and file name generation 4670 attempted. If no match is found, it rings the bell. Otherwise, the word is 4671 replaced by the matching pattern and input mode is entered. 4672 .RE 4673 4674 .sp 4675 .ne 2 4676 .na 4677 \fB\fB\e\fR\fR 4678 .ad 4679 .RS 19n 4680 Command or file name completion as described in this manual page. 4681 .RE 4682 4683 .SS "Other Edit Commands" 4684 .LP 4685 The following miscellaneous edit commands are supported: 4686 .sp 4687 .ne 2 4688 .na 4689 \fB\fB[\fR\fIcount\fR\fB]y\fR\fImotion\fR\fR 4690 .ad 4691 .br 4692 .na 4693 \fB\fBy[\fR\fIcount\fR\fB]\fR\fImotion\fR\fR 4694 .ad 4695 .RS 18n 4696 Yank the current character through the character to which \fImotion\fR would 4697 move the cursor. Put the yanked characters in the delete buffer. The text and 4698 cursor position are unchanged. 4699 .RE 4700 4701 .sp 4702 .ne 2 4703 .na 4704 \fB\fByy\fR\fR 4705 .ad 4706 .RS 18n 4707 Yank the current line. 4708 .RE 4709 4710 .sp 4711 .ne 2 4712 .na 4713 \fB\fBY\fR\fR 4714 .ad 4715 .RS 18n 4716 Yank the current line from the current cursor location to the end of the line. 4717 Equivalent to \fBy$\fR. 4718 .RE 4719 4720 .sp 4721 .ne 2 4722 .na 4723 \fB\fBu\fR\fR 4724 .ad 4725 .RS 18n 4726 Undo the last text modifying command. 4727 .RE 4728 4729 .sp 4730 .ne 2 4731 .na 4732 \fB\fBU\fR\fR 4733 .ad 4734 .RS 18n 4735 Undo all the text modifying commands performed on current line. 4736 .RE 4737 4738 .sp 4739 .ne 2 4740 .na 4741 \fB\fB[\fR\fIcount\fR\fB]V\fR\fR 4742 .ad 4743 .RS 18n 4744 Return the command : 4745 .sp 4746 .in +2 4747 .nf 4748 hist -e ${VISUAL:-${EDITOR:-vi}} \fIcount\fR 4749 .fi 4750 .in -2 4751 .sp 4752 4753 in the input buffer. If \fIcount\fR is omitted, the current line is used. 4754 .RE 4755 4756 .sp 4757 .ne 2 4758 .na 4759 \fB\fB^L\fR\fR 4760 .ad 4761 .RS 18n 4762 Line feed and print the current line. This command only works in control mode. 4763 .RE 4764 4765 .sp 4766 .ne 2 4767 .na 4768 \fB\fB^J\fR\fR 4769 .ad 4770 .RS 18n 4771 New line. Execute the current line, regardless of mode. 4772 .RE 4773 4774 .sp 4775 .ne 2 4776 .na 4777 \fB\fB^M\fR\fR 4778 .ad 4779 .RS 18n 4780 Return. Execute the current line, regardless of mode. 4781 .RE 4782 4783 .sp 4784 .ne 2 4785 .na 4786 \fB\fB#\fR\fR 4787 .ad 4788 .RS 18n 4789 If the first character of the command is a \fB#\fR , delete this \fB#\fR and 4790 each \fB#\fR that follows a NEWLINE. 4791 .sp 4792 Otherwise, send the line after inserting a \fB#\fR in front of each line in the 4793 command. 4794 .sp 4795 This is command is useful for causing the current line to be inserted in the 4796 history as a comment and un-commenting previously commented commands in the 4797 history file. 4798 .RE 4799 4800 .sp 4801 .ne 2 4802 .na 4803 \fB\fB[\fR\fIcount\fR\fB]=\fR\fR 4804 .ad 4805 .RS 18n 4806 If \fIcount\fR is not specified, generate the list of matching commands or file 4807 names as described in this manual page. 4808 .sp 4809 Otherwise, replace the word at the current cursor location with the \fIcount\fR 4810 item from the most recently generated command or file list. If the cursor is 4811 not on a word, it is inserted after the current cursor location. 4812 .RE 4813 4814 .sp 4815 .ne 2 4816 .na 4817 \fB\fB@\fR\fIletter\fR\fR 4818 .ad 4819 .RS 18n 4820 Search your alias list for an alias by the name \fIletter\fR. If an alias of 4821 this name is defined, insert its value on the input queue for processing. 4822 .RE 4823 4824 .sp 4825 .ne 2 4826 .na 4827 \fB\fB^V\fR\fR 4828 .ad 4829 .RS 18n 4830 Display version of the shell. 4831 .RE 4832 4833 .SS "Built-in Commands" 4834 .LP 4835 The following simple-commands are executed in the shell process. Input and 4836 output redirection is permitted. Unless otherwise indicated, the output is 4837 written on file descriptor \fB1\fR and the exit status, when there is no syntax 4838 error, is \fB0\fR. Except for \fB:\fR, \fBtrue\fR, \fBfalse\fR, \fBecho\fR, 4839 \fBnewgrp\fR, and \fBlogin\fR, all built-in commands accept \fB--\fR to 4840 indicate the end of options. They also interpret the option \fB--man\fR as a 4841 request to display the manual page onto standard error and \fB-?\fR as a help 4842 request which prints a usage message on standard error. 4843 .sp 4844 .LP 4845 Commands that are preceded by one or two \fB++\fR symbols are special built-in 4846 commands and are treated specially in the following ways: 4847 .RS +4 4848 .TP 4849 1. 4850 Variable assignment lists preceding the command remain in effect when the 4851 command completes. 4852 .RE 4853 .RS +4 4854 .TP 4855 2. 4856 I/O redirections are processed after variable assignments. 4857 .RE 4858 .RS +4 4859 .TP 4860 3. 4861 Errors cause a script that contains them to abort. 4862 .RE 4863 .RS +4 4864 .TP 4865 4. 4866 They are not valid function names. 4867 .RE 4868 .RS +4 4869 .TP 4870 5. 4871 Words following a command preceded by \fB++\fR that are in the format of a 4872 variable assignment are expanded with the same rules as a variable assignment. 4873 This means that tilde substitution is performed after the \fB=\fR sign and 4874 field splitting and file name generation are not performed. 4875 .RE 4876 .sp 4877 .ne 2 4878 .na 4879 \fB\fB+ : [\fR\fIarg ...\fR\fB]\fR\fR 4880 .ad 4881 .sp .6 4882 .RS 4n 4883 The command only expands parameters. 4884 .RE 4885 4886 .sp 4887 .ne 2 4888 .na 4889 \fB\fB+ .\fR \fIname\fR \fB[\fR\fIarg ...\fR\fB]\fR\fR 4890 .ad 4891 .sp .6 4892 .RS 4n 4893 If \fIname\fR is a function defined with the \fBfunction\fR \fBname\fR reserved 4894 word syntax, the function is executed in the current environment (as if it had 4895 been defined with the \fIname()\fR syntax.) Otherwise if \fIname\fR refers to a 4896 file, the file is read in its entirety and the commands are executed in the 4897 current shell environment. The search path specified by PATH is used to find 4898 the directory containing the file. If any arguments \fIarg\fR are specified, 4899 they become the positional parameters while processing the . command and the 4900 original positional parameters are restored upon completion. Otherwise the 4901 positional parameters are unchanged. The exit status is the exit status of the 4902 last command executed. 4903 .RE 4904 4905 .sp 4906 .ne 2 4907 .na 4908 \fB\fB++ alias [\fR\fB-ptx\fR\fB] [\fR\fIname\fR\fB[ 4909 =\fR\fIvalue\fR\fB]] ...\fR\fR 4910 .ad 4911 .sp .6 4912 .RS 4n 4913 \fBalias\fR with no arguments prints the list of aliases in the form 4914 \fIname\fR\fB=\fR\fIvalue\fR on standard output. The \fB-p\fR option causes the 4915 word alias to be inserted before each one. When one or more arguments are 4916 specified, an \fIalias\fR is defined for each \fIname\fR whose \fIvalue\fR is 4917 specified. A trailing space in \fIvalue\fR causes the next word to be checked 4918 for alias substitution. The obsolete \fB-t\fR option is used to set and list 4919 tracked aliases. The value of a tracked alias is the full pathname 4920 corresponding to the specified \fIname\fR. The value becomes undefined when the 4921 value of \fBPATH\fR is reset but the alias remains tracked. Without the 4922 \fB-t\fR option, for each \fIname\fR in the argument list for which no 4923 \fIvalue\fR is specified, the name and value of the alias is printed. The 4924 obsolete -x option has no effect. The exit status is \fBnon-zero\fR if a 4925 \fIname\fR is specified, but no value, and no alias has been defined for the 4926 \fIname\fR. 4927 .RE 4928 4929 .sp 4930 .ne 2 4931 .na 4932 \fB\fBbg [\fR \fIjob\fR\fB\&...]\fR\fR 4933 .ad 4934 .sp .6 4935 .RS 4n 4936 This command is only on systems that support job control. Puts each specified 4937 \fIjob\fR into the background. The current job is put in the background if 4938 \fIjob\fR is not specified. See the \fBJobs\fR section of this manual page for 4939 a description of the format of \fIjob\fR. 4940 .RE 4941 4942 .sp 4943 .ne 2 4944 .na 4945 \fB\fB+ break [\fR\fIn\fR\fB]\fR\fR 4946 .ad 4947 .sp .6 4948 .RS 4n 4949 Exit from the enclosing \fBfor\fR, \fBwhile\fR, \fBuntil\fR, or \fBselect\fR 4950 loop, if any. If \fIn\fR is specified, then break \fIn\fR levels. 4951 .RE 4952 4953 .sp 4954 .ne 2 4955 .na 4956 \fB\fBbuiltin [\fR\fB-ds\fR \fB] [\fR\fB-f\fR \fIfile\fR\fB] 4957 [\fR\fIname ...\fR\fB]\fR\fR 4958 .ad 4959 .sp .6 4960 .RS 4n 4961 If \fIname\fR is not specified, and no \fB-f\fR option is specified, the 4962 built-ins are printed on standard output. The \fB-s\fR option prints only the 4963 special built-ins. Otherwise, each \fIname\fR represents the pathname whose 4964 basename is the name of the built-in. The entry point function name is 4965 determined by prepending \fIb\fR to the built-in name. The ISO C/C++ prototype 4966 is \fBb\fR\fImycommand(int argc, char *argv[], void *context)\fR for the 4967 built-in command \fImycommand\fR where \fIargv\fR is an array of \fIargc\fR 4968 elements and \fIcontext\fR is an optional pointer to a \fBShell_t\fR structure 4969 as described in \fB<ast/shell.h>\fR Special built-ins cannot be bound to a 4970 pathname or deleted. The \fB-d\fR option deletes each of the specified 4971 built-ins. On systems that support dynamic loading, the \fB-f\fR option names a 4972 shared library containing the code for built-ins. The shared library prefix 4973 and/or suffix, which depend on the system, can be omitted. Once a library is 4974 loaded, its symbols become available for subsequent invocations of 4975 \fBbuiltin\fR. Multiple libraries can be specified with separate invocations of 4976 the \fBbuiltin\fR command. Libraries are searched in the reverse order in which 4977 they are specified. When a library is loaded, it looks for a function in the 4978 library whose name is \fBlib_init()\fR and invokes this function with an 4979 argument of \fB0\fR. 4980 .RE 4981 4982 .sp 4983 .ne 2 4984 .na 4985 \fB\fBcd\fR \fB[\fR\fB-LP\fR\fB] [\fR\fIarg\fR\fB]\fR\fR 4986 .ad 4987 .br 4988 .na 4989 \fB\fBcd\fR \fB[\fR\fB-LP\fR\fB]\fR \fIold\fR \fInew\fR\fR 4990 .ad 4991 .sp .6 4992 .RS 4n 4993 This command has two forms. 4994 .sp 4995 In the first form it changes the current directory to \fIarg\fR. If \fIarg\fR 4996 is a \fB-\fR, the directory is changed to the previous directory. The shell 4997 variable \fBHOME\fR is the default \fIarg\fR. The variable \fBPWD\fR is set to 4998 the current directory. The shell variable \fBCDPATH\fR defines the search path 4999 for the directory containing \fIarg\fR. Alternative directory names are 5000 separated by a colon (\fB:\fR). The default path is \fBNULL\fR (specifying the 5001 current directory). The current directory is specified by a null path name, 5002 which can appear immediately after the equal sign or between the colon 5003 delimiters anywhere else in the path list. If \fIarg\fR begins with a \fB/\fR, 5004 the search path is not used. Otherwise, each directory in the path is searched 5005 for \fIarg\fR. 5006 .sp 5007 The second form of \fBcd\fR substitutes the string \fInew\fR for the string 5008 \fIold\fR in the current directory name, \fBPWD\fR, and tries to change to this 5009 new directory. By default, symbolic link names are treated literally when 5010 finding the directory name. This is equivalent to the \fB-L\fR option. The 5011 \fB-P\fR option causes symbolic links to be resolved when determining the 5012 directory. The last instance of \fB-L\fR or \fB-P\fR on the command line 5013 determines which method is used. The \fBcd\fR command cannot be executed by 5014 \fBrksh93\fR. 5015 .RE 5016 5017 .sp 5018 .ne 2 5019 .na 5020 \fB\fBcommand\fR \fB[\fR\fB-pvVx\fR\fB]\fR \fIname\fR 5021 \fB[\fR\fIarg ...\fR\fB]\fR\fR 5022 .ad 5023 .sp .6 5024 .RS 4n 5025 Without the \fB-v\fR or \fB-V\fR options, executes \fIname\fR with the 5026 arguments specified by \fIarg\fR. 5027 .sp 5028 The \fB-p\fR option causes a default path to be searched rather than the one 5029 defined by the value of \fBPATH\fR. Functions are not searched when finding 5030 \fIname\fR. In addition, if \fIname\fR refers to a special built-in, none of 5031 the special properties associated with the leading daggers are honored. For 5032 example, the predefined alias \fBredirect='command exec'\fR prevents a script 5033 from terminating when an invalid redirection is specified. 5034 .sp 5035 With the \fB-x\fR option, if command execution would result in a failure 5036 because there are too many arguments, \fBerrno E2BIG\fR, the shell invokes 5037 command \fIname\fR multiple times with a subset of the arguments on each 5038 invocation. Arguments that occur prior to the first word that expands to 5039 multiple arguments and after the last word that expands to multiple arguments 5040 are passed on each invocation. The exit status is the maximum invocation exit 5041 status. 5042 .sp 5043 With the \fB-v\fR option, \fBcommand\fR is equivalent to the built-in 5044 \fBwhence\fR command described in this section. The \fB-V\fR option causes 5045 \fBcommand\fR to act like \fBwhence -v\fR. 5046 .RE 5047 5048 .sp 5049 .ne 2 5050 .na 5051 \fB\fB+continue\fR \fB[\fR\fIn\fR\fB]\fR\fR 5052 .ad 5053 .sp .6 5054 .RS 4n 5055 Resumes the next iteration of the enclosing \fBfor\fR, \fBwhile\fR, 5056 \fBuntil\fR, or \fBselect\fR loop. If \fIn\fR is specified, then resume at the 5057 \fIn\fRth enclosing loop. 5058 .RE 5059 5060 .sp 5061 .ne 2 5062 .na 5063 \fB\fBdisown\fR \fB[\fR\fIjob...\fR\fB]\fR\fR 5064 .ad 5065 .sp .6 5066 .RS 4n 5067 Causes the shell not to send a \fBHUP\fR signal to each specified \fIjob\fR, or 5068 all active jobs if \fIjob\fR is omitted, when a login shell terminates. 5069 .RE 5070 5071 .sp 5072 .ne 2 5073 .na 5074 \fB\fBecho\fR \fB[\fR\fIarg ...\fR\fB]\fR\fR 5075 .ad 5076 .sp .6 5077 .RS 4n 5078 When the first \fIarg\fR does not begin with a \fB-\fR, and none of the 5079 arguments contain a backslash (\fB\e\fR), prints each of its arguments 5080 separated by a SPACE and terminated by a NEWLINE. Otherwise, the behavior of 5081 \fBecho\fR is system dependent and \fBprint\fR or \fBprintf\fR described in 5082 this section should be used. See \fBecho\fR(1) for usage and description. 5083 .RE 5084 5085 .sp 5086 .ne 2 5087 .na 5088 \fB\fB+eval\fR \fB[\fR\fIarg ...\fR\fB]\fR\fR 5089 .ad 5090 .sp .6 5091 .RS 4n 5092 The arguments are read as input to the shell and the resulting commands are 5093 executed. 5094 .RE 5095 5096 .sp 5097 .ne 2 5098 .na 5099 \fB\fB+exec\fR [\fB-c\fR] [\fB-a\fR \fIname ...\fR] 5100 \fB[\fR\fIarg ...\fR\fB]\fR\fR 5101 .ad 5102 .sp .6 5103 .RS 4n 5104 If \fIarg\fR is specified, the command specified by the arguments is executed 5105 in place of this shell without creating a new process. The \fB-c\fR option 5106 causes the environment to be cleared before applying variable assignments 5107 associated with the exec invocation. The \fB-a\fR option causes \fIname\fR 5108 rather than the first \fIarg\fR, to become \fBargv[0]\fR for the new process. 5109 Input and output arguments can appear and affect the current process. If 5110 \fIarg\fR is not specified, the effect of this command is to modify file 5111 descriptors as prescribed by the input/output redirection list. In this case, 5112 any file descriptor numbers greater than \fB2\fR that are opened with this 5113 mechanism are closed when invoking another program. 5114 .RE 5115 5116 .sp 5117 .ne 2 5118 .na 5119 \fB\fB+exit\fR \fB[\fR\fIn\fR\fB]\fR\fR 5120 .ad 5121 .sp .6 5122 .RS 4n 5123 Causes the shell to exit with the exit status specified by \fIn\fR. The value 5124 is the least significant 8 bits of the specified status. If \fIn\fR is omitted, 5125 then the exit status is that of the last command executed. An end-of-file also 5126 causes the shell to exit except for a shell which has the \fBignoreeof\fR 5127 option turned on. See \fBset\fR. 5128 .RE 5129 5130 .sp 5131 .ne 2 5132 .na 5133 \fB\fB++export\fR \fB[\fR\fB-p\fR\fB]\fR 5134 \fB[\fR\fIname\fR\fB[=\fR\fIvalue\fR\fB]] ...\fR\fR 5135 .ad 5136 .sp .6 5137 .RS 4n 5138 If \fIname\fR is not specified, the names and values of each variable with the 5139 export attribute are printed with the values quoted in a manner that allows 5140 them to be re-entered. The \fB-p\fR option causes the word export to be 5141 inserted before each one. Otherwise, the specified \fIname\fRs are marked for 5142 automatic export to the environment of subsequently-executed commands. 5143 .RE 5144 5145 .sp 5146 .ne 2 5147 .na 5148 \fB\fBfalse\fR\fR 5149 .ad 5150 .sp .6 5151 .RS 4n 5152 Does nothing, and exits \fB1\fR. Used with \fBuntil\fR for infinite loops. 5153 .RE 5154 5155 .sp 5156 .ne 2 5157 .na 5158 \fB\fBfg\fR \fB[\fR\fIjob ...\fR\fB]\fR\fR 5159 .ad 5160 .sp .6 5161 .RS 4n 5162 This command is only on systems that support job control. Each \fIjob\fR 5163 specified is brought to the foreground and waited for in the specified order. 5164 Otherwise, the current job is brought into the foreground. See \fBJobs\fR for a 5165 description of the format of \fIjob\fR. 5166 .RE 5167 5168 .sp 5169 .ne 2 5170 .na 5171 \fB\fBgetconf\fR \fB[\fR\fIname\fR \fB[\fR\fIpathname\fR\fB]]\fR\fR 5172 .ad 5173 .sp .6 5174 .RS 4n 5175 Prints the current value of the configuration parameter specified by 5176 \fIname\fR. The configuration parameters are defined by the IEEE POSIX 1003.1 5177 and IEEE POSIX 1003.2 standards. See \fBpathconf\fR(2) and \fBsysconf\fR(3C). 5178 .sp 5179 The \fIpathname\fR argument is required for parameters whose value depends on 5180 the location in the file system. If no arguments are specified, \fBgetconf\fR 5181 prints the names and values of the current configuration parameters. The 5182 pathname \fB/\fR is used for each of the parameters that requires 5183 \fIpathname\fR. 5184 .RE 5185 5186 .sp 5187 .ne 2 5188 .na 5189 \fB\fBgetopts\fR \fB[\fR \fB-a\fR \fIname\fR\fB]\fR \fIoptstring\fR \fIvname\fR 5190 \fB[\fR\fIarg ...\fR\fB]\fR\fR 5191 .ad 5192 .sp .6 5193 .RS 4n 5194 Checks \fIarg\fR for legal options. If \fIarg\fR is omitted, the positional 5195 parameters are used. An option argument begins with a \fB+\fR or a \fB-\fR. An 5196 option that does not begin with \fB+\fR or \fB-\fR or the argument \fB--\fR 5197 ends the options. Options beginning with \fB+\fR are only recognized when 5198 \fIoptstring\fR begins with a \fB+\fR. \fIoptstring\fR contains the letters 5199 that \fBgetopts\fR recognizes. If a letter is followed by a \fB:\fR, that 5200 option is expected to have an argument. The options can be separated from the 5201 argument by blanks. The option \fB-?\fRcauses \fBgetopts\fR to generate a usage 5202 message on standard error. The \fB-a\fR option can be used to specify the name 5203 to use for the usage message, which defaults to $0. \fBgetopts\fR places the 5204 next option letter it finds inside variable \fIvname\fR each time it is 5205 invoked. The option letter is prepended with a \fB+\fR when \fIarg\fR begins 5206 with a \fB+\fR. The index of the next \fIarg\fR is stored in \fBOPTIND\fR. The 5207 option argument, if any, gets stored in \fBOPTARG\fR. A leading : in 5208 \fIoptstring\fR causes \fBgetopts\fR to store the letter of an invalid option 5209 in \fBOPTARG\fR, and to set \fIvname\fR to \fB?\fR for an unknown option and 5210 to: when a required option argument is missing. Otherwise, \fBgetopts\fR prints 5211 an error message. The exit status is \fBnon-zero\fR when there are no more 5212 options. There is no way to specify any of the options \fB:\fR, \fB+\fR, 5213 \fB-\fR, \fB?\fR, \fB[\fR, and \fB]\fR. The option \fB#\fR can only be 5214 specified as the first option. 5215 .RE 5216 5217 .sp 5218 .ne 2 5219 .na 5220 \fB\fBhist\fR \fB[\fR \fB-e\fR \fIename\fR\fB]\fR\fB[\fR\fB-nlr\fR\fB]\fR 5221 \fB[\fR \fIfirst\fR\fB[\fR\fIlast\fR \fB] ]\fR\fR 5222 .ad 5223 .br 5224 .na 5225 \fB\fR 5226 .ad 5227 .br 5228 .na 5229 \fB\fBhist\fR \fB-s\fR \fB[\fR \fIold\fR\fB=\fR\fInew\fR \fB] [\fR 5230 \fIcommand\fR\fB]\fR\fR 5231 .ad 5232 .sp .6 5233 .RS 4n 5234 In the first form, a range of commands from \fIfirst\fR to \fIlast\fR is 5235 selected from the last \fBHISTSIZE\fR commands that were typed at the terminal. 5236 The arguments \fIfirst\fR and \fIlast\fR can be specified as a number or as a 5237 string. A string is used to locate the most recent command starting with the 5238 specified string. A negative number is used as an offset to the current command 5239 number. If the -l option is selected, the commands are listed on standard 5240 output. Otherwise, the editor program \fIename\fR is invoked on a file 5241 containing these keyboard commands. If \fIename\fR is not supplied, then the 5242 value of the variable \fBHISTEDIT\fR is used. If \fBHISTEDIT\fR is not set, 5243 then \fBFCEDIT\fR (default \fB/bin/ed\fR) is used as the editor. When editing 5244 is complete, the edited command(s) is executed if the changes have been saved. 5245 If \fIlast\fR is not specified, then it is set to \fIfirst\fR. If \fIfirst\fR 5246 is not specified, the default is the previous command for editing and \fB-16\fR 5247 for listing. The option \fB-r\fR reverses the order of the commands and the 5248 option \fB-n\fR suppresses command numbers when listing. In the second form, 5249 \fIcommand\fR is interpreted as \fIfirst\fR described in this section and 5250 defaults to the last command executed. The resulting command is executed after 5251 the optional substitution \fIold\fR\fB=\fR\fInew\fR is performed. 5252 .RE 5253 5254 .sp 5255 .ne 2 5256 .na 5257 \fB\fBjobs\fR \fB-lnp\fR \fB[\fR\fIjob ...\fR\fB]\fR\fR 5258 .ad 5259 .sp .6 5260 .RS 4n 5261 Lists information about each specified job, or all active jobs if \fIjob\fR is 5262 omitted. The \fB-l\fR option lists process ids in addition to the normal 5263 information. The \fB-n\fR option only displays jobs that have stopped or exited 5264 since last notified. The \fB-p\fR option causes only the process group to be 5265 listed. See \fBJobs\fR for a description of the format of \fIjob\fR. 5266 .RE 5267 5268 .sp 5269 .ne 2 5270 .na 5271 \fB\fBkill\fR \fB[\fR\fB-s\fR \fIsigname\fR\fB]\fR \fIjob ...\fR\fR 5272 .ad 5273 .br 5274 .na 5275 \fB\fBkill\fR \fB[\fR\fB-n\fR \fIsignum\fR\fB]\fR \fIjob ...\fR\fR 5276 .ad 5277 .br 5278 .na 5279 \fB\fBkill\fR \fB-l\fR \fB[\fR\fIsig ...\fR\fB]\fR\fR 5280 .ad 5281 .sp .6 5282 .RS 4n 5283 Sends either the \fBTERM\fR (terminate) signal or the specified signal to the 5284 specified jobs or processes. Signals are either specified by number with the 5285 \fB-n\fR option or by name with the \fB-s\fR option (as specified in 5286 \fB<signal.h\fR>, stripped of the prefix `\fBSIG\fR with the exception that 5287 \fBSIGCLD\fR is named \fBCHLD\fR). For backward compatibility, the \fBn\fR and 5288 \fBs\fR can be omitted and the number or name placed immediately after the 5289 \fB-\fR. If the signal being sent is \fBTERM\fR (terminate) or \fBHUP\fR (hang 5290 up), then the job or process is sent a \fBCONT\fR (continue) signal if it is 5291 stopped. The argument \fIjob\fR can be the process id of a process that is not 5292 a member of one of the active jobs. See \fBJobs\fR for a description of the 5293 format of \fIjob\fR. In the third form, \fBkill -l\fR, if \fIsig\fR is not 5294 specified, the signal names are listed. Otherwise, for each \fIsig\fR that is a 5295 name, the corresponding signal number is listed. For each \fIsig\fR that is a 5296 number, the signal name corresponding to the least significant 8 bits of 5297 \fIsig\fR is listed. 5298 .RE 5299 5300 .sp 5301 .ne 2 5302 .na 5303 \fB\fBlet\fR \fB[\fR\fIarg ...\fR\fB]\fR\fR 5304 .ad 5305 .sp .6 5306 .RS 4n 5307 Each \fIarg\fR is a separate arithmetic expression to be evaluated. See the 5308 \fBArithmetic Evaluation\fR section of this manual page for a description of 5309 arithmetic expression evaluation. The exit status is \fB0\fR if the value of 5310 the last expression is \fBnon-zero\fR, and \fB1\fR otherwise. 5311 .RE 5312 5313 .sp 5314 .ne 2 5315 .na 5316 \fB\fB+newgrp\fR \fB[\fR\fIarg ...\fR\fB]\fR\fR 5317 .ad 5318 .sp .6 5319 .RS 4n 5320 Equivalent to \fBexec\fR \fB/bin/newgrp\fR \fIarg ...\fR 5321 .RE 5322 5323 .sp 5324 .ne 2 5325 .na 5326 \fB\fBprint\fR [\fB-Renprs\fR] \fB[\fR \fB-u\fR \fIunit\fR\fB] [\fR \fB-f\fR 5327 \fIformat\fR \fB] [\fR \fIarg ...\fR\fB]\fR\fR 5328 .ad 5329 .sp .6 5330 .RS 4n 5331 With no options or with option \fB-\fR or \fB--\fR, each \fIarg\fR is printed 5332 on standard output. The \fB-f\fR option causes the arguments to be printed as 5333 described by \fBprintf\fR. In this case, any \fBe\fR, \fBn\fR, \fBr\fR, or 5334 \fBR\fR options are ignored. Otherwise, unless the \fB-R\fR or \fB-r,\fR are 5335 specified, the following escape conventions are applied: 5336 .sp 5337 .ne 2 5338 .na 5339 \fB\fB\ea\fR\fR 5340 .ad 5341 .RS 8n 5342 Alert character (\fBASCII\fR 07) 5343 .RE 5344 5345 .sp 5346 .ne 2 5347 .na 5348 \fB\fB\eb\fR\fR 5349 .ad 5350 .RS 8n 5351 Backspace character (\fBASCII\fR 010) 5352 .RE 5353 5354 .sp 5355 .ne 2 5356 .na 5357 \fB\fB\ec\fR\fR 5358 .ad 5359 .RS 8n 5360 Causes print to end without processing more arguments and not adding a NEWLINE 5361 .RE 5362 5363 .sp 5364 .ne 2 5365 .na 5366 \fB\fB\ef\fR\fR 5367 .ad 5368 .RS 8n 5369 Form-feed character (\fBASCII\fR 014) 5370 .RE 5371 5372 .sp 5373 .ne 2 5374 .na 5375 \fB\fB\en\fR\fR 5376 .ad 5377 .RS 8n 5378 NEWLINE character (\fBASCII\fR 012) 5379 .RE 5380 5381 .sp 5382 .ne 2 5383 .na 5384 \fB\fB\er\fR\fR 5385 .ad 5386 .RS 8n 5387 RETURN character (\fBASCII\fR 015) 5388 .RE 5389 5390 .sp 5391 .ne 2 5392 .na 5393 \fB\fB\et\fR\fR 5394 .ad 5395 .RS 8n 5396 TAB character (\fBASCII\fR 011) 5397 .RE 5398 5399 .sp 5400 .ne 2 5401 .na 5402 \fB\fB\ev\fR\fR 5403 .ad 5404 .RS 8n 5405 Vertical TAB character (\fBASCII\fR 013) 5406 .RE 5407 5408 .sp 5409 .ne 2 5410 .na 5411 \fB\fB\eE\fR\fR 5412 .ad 5413 .RS 8n 5414 Escape character (\fBASCII\fR 033) 5415 .RE 5416 5417 .sp 5418 .ne 2 5419 .na 5420 \fB\fB\e\e\fR\fR 5421 .ad 5422 .RS 8n 5423 Backslash character \fB\e\fR 5424 .RE 5425 5426 .sp 5427 .ne 2 5428 .na 5429 \fB\fB\e0\fR\fIx\fR\fR 5430 .ad 5431 .RS 8n 5432 Character defined by the 1, 2, or 3-digit octal string specified by \fIx\fR 5433 .RE 5434 5435 The \fB-R\fR option prints all subsequent arguments and options other than 5436 \fB-n\fR. The \fB-e\fR causes the escape conventions to be applied This is the 5437 default behavior. It reverses the effect of an earlier \fB-r\fR. The \fB-p\fR 5438 option causes the arguments to be written onto the pipe of the process spawned 5439 with \fB|&\fR instead of standard output. The \fB-s\fR option causes the 5440 arguments to be written onto the history file instead of standard output. The 5441 \fB-u\fR option can be used to specify a one digit file descriptor unit number 5442 \fIunit\fR on which the output is placed. The default is \fB1\fR. If the option 5443 \fB-n\fR is used, no NEWLINE is added to the output. 5444 .RE 5445 5446 .sp 5447 .ne 2 5448 .na 5449 \fB\fBprintf\fR \fIformat\fR\fB[\fR\fIarg ...\fR\fB]\fR\fR 5450 .ad 5451 .sp .6 5452 .RS 4n 5453 The arguments \fIarg\fR are printed on standard output in accordance with the 5454 \fBANSI-C\fR formatting rules associated with the format string \fIformat\fR. 5455 If the number of arguments exceeds the number of format specifications, the 5456 format string is reused to format remaining arguments. The following extensions 5457 can also be used: A \fB%b\fR format can be used instead of \fB%s\fR to cause 5458 escape sequences in the corresponding \fIarg\fR to be expanded as described in 5459 \fBprint\fR. A \fB%B\fR option causes each of the arguments to be treated as 5460 variable names and the binary value of the variables is printed. This is most 5461 useful for variables with an attribute of b. A \fB%H\fR format can be used 5462 instead of \fB%s\fR to cause characters in \fIarg\fR that are special in 5463 \fBHTML\fR and \fBXML\fR to be output as their entity name. A \fB%P\fR format 5464 can be used instead of \fB%s\fR to cause \fIarg\fR to be interpreted as an 5465 extended regular expression and be printed as a shell pattern. A \fB%R\fR 5466 format can be used instead of \fB%s\fR to cause \fIarg\fR to be interpreted as 5467 a shell pattern and to be printed as an extended regular expression. A \fB%q\fR 5468 format can be used instead of \fB%\fRs to cause the resulting string to be 5469 quoted in a manner than can be input again to the shell. A 5470 \fB%(\fR\fIdate-format\fR\fB)T\fR format can be use to treat an argument as a 5471 date/time string and to format the date/time according to the \fIdate-format\fR 5472 as defined for the \fBdate\fR(1) command. A \fB%Z\fR format outputs a byte 5473 whose value is 0. The precision field of the %d format can be followed by a . 5474 and the output base. In this case, the \fB#\fR flag character causes 5475 \fBbase\fR\fI#\fR to be prepended. The \fB#\fR flag when used with the \fBd\fR 5476 specifier without an output base, causes the output to be displayed in 5477 thousands units with one of the suffixes \fBk\fR \fBM\fR \fBG\fR \fBT\fR 5478 \fBP\fR \fBE\fR to indicate the unit. The \fB#\fR flag when used with the i 5479 specifier causes the output to be displayed in \fB1024\fR with one of the 5480 suffixes \fBKi\fR \fBMi\fR \fBGi\fR \fBTi\fR \fBPi\fR \fBEi\fR to indicate the 5481 unit. The \fB=\fR flag has been added to center the output within the specified 5482 field width. 5483 .RE 5484 5485 .sp 5486 .ne 2 5487 .na 5488 \fB\fBpwd\fR [\fB-LP\fR]\fR 5489 .ad 5490 .sp .6 5491 .RS 4n 5492 Outputs the value of the current working directory. The \fB-L\fR option is the 5493 default. It prints the logical name of the current directory. If the \fB-P\fR 5494 option is specified, all symbolic links are resolved from the name. The last 5495 instance of \fB-L\fR or \fB-P\fR on the command line determines which method is 5496 used. 5497 .RE 5498 5499 .sp 5500 .ne 2 5501 .na 5502 \fB\fBread\fR \fB[\fR\fB-Aprs\fR\fB] [\fR\fB-d\fR \fIdelim\fR\fB] [\fR \fB-n\fR 5503 \fIn\fR\fB] [[\fR \fB-N\fR \fIn\fR\fB] [[\fR\fB-t\fR \fItimeout\fR\fB] 5504 [\fR\fB-u\fR \fIunit\fR\fB] [\fR\fIvname\fR\fB?\fR\fIprompt\fR\fB] [\fR 5505 \fIvname ...\fR \fB]\fR\fR 5506 .ad 5507 .sp .6 5508 .RS 4n 5509 The shell input mechanism. One line is read and is broken up into fields using 5510 the characters in IFS as separators. The escape character, \fB\e\fR, is used to 5511 remove any special meaning for the next character and for line continuation. 5512 The \fB-d\fR option causes the read to continue to the first character of 5513 \fIdelim\fR rather than \fBNEWLINE\fR. The \fB-n\fR option causes at most 5514 \fIn\fR bytes to read rather a full line but returns when reading from a slow 5515 device as soon as any characters have been read. The \fB-N\fR option causes 5516 exactly \fIn\fR to be read unless an end-of-file has been encountered or the 5517 read times out because of the \fB-t\fR option. In raw mode, \fB-r\fR, the 5518 \fB\e\fR character is not treated specially. The first field is assigned to the 5519 first \fIvname\fR, the second field to the second \fIvname\fR, etc., with 5520 leftover fields assigned to the last \fIvname\fR. When \fIvname\fR has the 5521 binary attribute and \fB-n\fR or \fB-N\fR is specified, the bytes that are read 5522 are stored directly into the variable. If the -v is specified, then the value 5523 of the first \fIvname\fR is used as a default value when reading from a 5524 terminal device. The \fB-A\fR option causes the variable \fIvname\fR to be 5525 unset and each field that is read to be stored in successive elements of the 5526 indexed array \fIvname\fR. The \fB-p\fR option causes the input line to be 5527 taken from the input pipe of a process spawned by the shell using \fB|&\fR. If 5528 the \fB-s\fR option is present, the input is saved as a command in the history 5529 file. The option \fB-u\fR can be used to specify a one digit file descriptor 5530 unit \fIunit\fR to read from. The file descriptor can be opened with the 5531 \fBexec\fR special built-in command. The default value of unit \fIn\fR is 5532 \fB0\fR. The option \fB-t\fR is used to specify a time out in seconds when 5533 reading from a terminal or pipe. If \fIvname\fR is omitted, then REPLY is used 5534 as the default \fIvname\fR. An end-of-file with the \fB-p\fR option causes 5535 cleanup for this process so that another can be spawned. If the first argument 5536 contains a \fB?\fR, the remainder of this word is used as a prompt on standard 5537 error when the shell is interactive. The exit status is \fB0\fR unless an 5538 end-of-file is encountered or read has timed out. 5539 .RE 5540 5541 .sp 5542 .ne 2 5543 .na 5544 \fB\fB++readonly\fR \fB[\fR\fB-p\fR\fB] [\fR 5545 \fIvname\fR\fB[=\fR\fIvalue\fR\fB]] ...\fR\fR 5546 .ad 5547 .sp .6 5548 .RS 4n 5549 If \fIvname\fR is not specified, the names and values of each variable with the 5550 read-only attribute is printed with the values quoted in a manner that allows 5551 them to be input again. The \fB-p\fR option causes the word \fBreadonly\fR to 5552 be inserted before each one. Otherwise, the specified \fIvname\fRs are marked 5553 \fBreadonly\fR and these names cannot be changed by subsequent assignment. 5554 .RE 5555 5556 .sp 5557 .ne 2 5558 .na 5559 \fB\fB+return\fR \fB[\fR\fIn\fR\fB]\fR\fR 5560 .ad 5561 .sp .6 5562 .RS 4n 5563 Causes a shell function or script to return to the invoking script with the 5564 exit status specified by \fIn\fR. The value is the least significant 8 bits of 5565 the specified status. If \fBn\fR is omitted, then the return status is that of 5566 the last command executed. If return is invoked while not in a function or a 5567 script, then it behaves the same as exit. 5568 .RE 5569 5570 .sp 5571 .ne 2 5572 .na 5573 \fB\fB+set [ \(+-BCGabefhkmnoprstuvx] [\(+-o [\fR \fIoption\fR \fB] ] ... [ 5574 \(+-A\fR \fIvname\fR\fB]\fR \fB[\fR\fIarg...\fR\fB]\fR\fR 5575 .ad 5576 .sp .6 5577 .RS 4n 5578 The \fBset\fR command supports the following options: 5579 .sp 5580 .ne 2 5581 .na 5582 \fB\fB-a\fR\fR 5583 .ad 5584 .sp .6 5585 .RS 4n 5586 All subsequent variables that are defined are automatically exported. 5587 .RE 5588 5589 .sp 5590 .ne 2 5591 .na 5592 \fB\fB-A\fR\fR 5593 .ad 5594 .sp .6 5595 .RS 4n 5596 Array assignment. Unset the variable \fIvname\fR and assign values sequentially 5597 from the \fIarg\fR list. If \fB+A\fR is used, the variable \fIvname\fR is not 5598 unset first. 5599 .RE 5600 5601 .sp 5602 .ne 2 5603 .na 5604 \fB\fB-b\fR\fR 5605 .ad 5606 .sp .6 5607 .RS 4n 5608 Prints job completion messages as soon as a background job changes state rather 5609 than waiting for the next prompt. 5610 .RE 5611 5612 .sp 5613 .ne 2 5614 .na 5615 \fB\fB-B\fR\fR 5616 .ad 5617 .sp .6 5618 .RS 4n 5619 Enable brace pattern field generation. This is the default behavior. 5620 .RE 5621 5622 .sp 5623 .ne 2 5624 .na 5625 \fB\fB-C\fR\fR 5626 .ad 5627 .sp .6 5628 .RS 4n 5629 Prevents redirection (\fB>\fR) from truncating existing files. Files that are 5630 created are opened with the \fBO_EXCL\fR mode. Requires \fB>|\fR to truncate a 5631 file when turned on. 5632 .RE 5633 5634 .sp 5635 .ne 2 5636 .na 5637 \fB\fB-e\fR\fR 5638 .ad 5639 .sp .6 5640 .RS 4n 5641 If a command has a \fBnon-zero\fR exit status, execute the \fBERR\fR trap, if 5642 set, and exit. This mode is disabled while reading profiles. 5643 .RE 5644 5645 .sp 5646 .ne 2 5647 .na 5648 \fB\fB-f\fR\fR 5649 .ad 5650 .sp .6 5651 .RS 4n 5652 Disables file name generation. 5653 .RE 5654 5655 .sp 5656 .ne 2 5657 .na 5658 \fB\fB-G\fR\fR 5659 .ad 5660 .sp .6 5661 .RS 4n 5662 Causes the pattern \fB**\fR by itself to match files and zero or more 5663 directories and subdirectories when used for file name generation. If followed 5664 by a \fB/\fR only directories and subdirectories are matched. 5665 .RE 5666 5667 .sp 5668 .ne 2 5669 .na 5670 \fB\fB-h\fR\fR 5671 .ad 5672 .sp .6 5673 .RS 4n 5674 Each command becomes a tracked alias when first encountered. 5675 .RE 5676 5677 .sp 5678 .ne 2 5679 .na 5680 \fB\fB-k\fR\fR 5681 .ad 5682 .sp .6 5683 .RS 4n 5684 Obsolete. All variable assignment arguments are placed in the environment for a 5685 command, not just those that precede the command name. 5686 .RE 5687 5688 .sp 5689 .ne 2 5690 .na 5691 \fB\fB-m\fR\fR 5692 .ad 5693 .sp .6 5694 .RS 4n 5695 Background jobs run in a separate process group and a line prints upon 5696 completion. The exit status of background jobs is reported in a completion 5697 message. On systems with job control, this option is turned on automatically 5698 for interactive shells. 5699 .RE 5700 5701 .sp 5702 .ne 2 5703 .na 5704 \fB\fB-n\fR\fR 5705 .ad 5706 .sp .6 5707 .RS 4n 5708 Read commands and check them for syntax errors, but do not execute them. 5709 Ignored for interactive shells. 5710 .RE 5711 5712 .sp 5713 .ne 2 5714 .na 5715 \fB\fB-o\fR\fR 5716 .ad 5717 .sp .6 5718 .RS 4n 5719 If no option name is supplied, the list of options and their current settings 5720 are written to standard output. When invoked with a \fB+\fR, the options are 5721 written in a format that can be input again to the shell to restore the 5722 settings. This option can be repeated to enable or disable multiple options. 5723 .sp 5724 The following argument can be one of the following option names: 5725 .sp 5726 .ne 2 5727 .na 5728 \fB\fBallexport\fR\fR 5729 .ad 5730 .sp .6 5731 .RS 4n 5732 Same as \fB-a\fR. 5733 .RE 5734 5735 .sp 5736 .ne 2 5737 .na 5738 \fB\fBbgnice\fR\fR 5739 .ad 5740 .sp .6 5741 .RS 4n 5742 All background jobs are run at a lower priority. This is the default mode. 5743 .RE 5744 5745 .sp 5746 .ne 2 5747 .na 5748 \fB\fBbraceexpand\fR\fR 5749 .ad 5750 .sp .6 5751 .RS 4n 5752 Same as \fB-\fRB. 5753 .RE 5754 5755 .sp 5756 .ne 2 5757 .na 5758 \fB\fBemacs\fR\fR 5759 .ad 5760 .sp .6 5761 .RS 4n 5762 Puts you in an \fBemacs\fR style inline editor for command entry. 5763 .RE 5764 5765 .sp 5766 .ne 2 5767 .na 5768 \fB\fBerrexit\fR\fR 5769 .ad 5770 .sp .6 5771 .RS 4n 5772 Same as \fB-e\fR. 5773 .RE 5774 5775 .sp 5776 .ne 2 5777 .na 5778 \fB\fBglobstar\fR\fR 5779 .ad 5780 .sp .6 5781 .RS 4n 5782 Same as \fB-G\fR. 5783 .RE 5784 5785 .sp 5786 .ne 2 5787 .na 5788 \fB\fBgmacs\fR\fR 5789 .ad 5790 .sp .6 5791 .RS 4n 5792 Puts you in a \fBgmacs\fR style inline editor for command entry. 5793 .RE 5794 5795 .sp 5796 .ne 2 5797 .na 5798 \fB\fBignoreeof\fR\fR 5799 .ad 5800 .sp .6 5801 .RS 4n 5802 The shell does not exit on end-of-file. The command \fBexit\fR must be used. 5803 .RE 5804 5805 .sp 5806 .ne 2 5807 .na 5808 \fB\fBkeyword\fR\fR 5809 .ad 5810 .sp .6 5811 .RS 4n 5812 Same as \fB-k\fR. 5813 .RE 5814 5815 .sp 5816 .ne 2 5817 .na 5818 \fB\fBmarkdirs\fR\fR 5819 .ad 5820 .sp .6 5821 .RS 4n 5822 All directory names resulting from file name generation have a trailing / 5823 appended. 5824 .RE 5825 5826 .sp 5827 .ne 2 5828 .na 5829 \fB\fBmonitor\fR\fR 5830 .ad 5831 .sp .6 5832 .RS 4n 5833 Same as \fB-m\fR. 5834 .RE 5835 5836 .sp 5837 .ne 2 5838 .na 5839 \fB\fBmultiline\fR\fR 5840 .ad 5841 .sp .6 5842 .RS 4n 5843 The built-in editors use multiple lines on the screen for lines that are longer 5844 than the width of the screen. This might not work for all terminals. 5845 .RE 5846 5847 .sp 5848 .ne 2 5849 .na 5850 \fB\fBnoclobber\fR\fR 5851 .ad 5852 .sp .6 5853 .RS 4n 5854 Same as \fB-C\fR. 5855 .RE 5856 5857 .sp 5858 .ne 2 5859 .na 5860 \fB\fBnoexec\fR\fR 5861 .ad 5862 .sp .6 5863 .RS 4n 5864 Same as \fB-n\fR. 5865 .RE 5866 5867 .sp 5868 .ne 2 5869 .na 5870 \fB\fBnoglob\fR\fR 5871 .ad 5872 .sp .6 5873 .RS 4n 5874 Same as \fB-f\fR. 5875 .RE 5876 5877 .sp 5878 .ne 2 5879 .na 5880 \fB\fBnolog\fR\fR 5881 .ad 5882 .sp .6 5883 .RS 4n 5884 Do not save function definitions in the history file. 5885 .RE 5886 5887 .sp 5888 .ne 2 5889 .na 5890 \fB\fBnotify\fR\fR 5891 .ad 5892 .sp .6 5893 .RS 4n 5894 Same as \fB-b\fR. 5895 .RE 5896 5897 .sp 5898 .ne 2 5899 .na 5900 \fB\fBnounset\fR\fR 5901 .ad 5902 .sp .6 5903 .RS 4n 5904 Same as \fB-u\fR. 5905 .RE 5906 5907 .sp 5908 .ne 2 5909 .na 5910 \fB\fBpipefail\fR\fR 5911 .ad 5912 .sp .6 5913 .RS 4n 5914 A pipeline does not complete until all components of the pipeline have 5915 completed, and the return value is the value of the last \fBnon-zero\fR command 5916 to fail or zero if no command has failed. 5917 .RE 5918 5919 .sp 5920 .ne 2 5921 .na 5922 \fB\fBprivileged\fR\fR 5923 .ad 5924 .sp .6 5925 .RS 4n 5926 Same as \fB-p\fR. 5927 .RE 5928 5929 .sp 5930 .ne 2 5931 .na 5932 \fB\fBshowme\fR\fR 5933 .ad 5934 .sp .6 5935 .RS 4n 5936 When enabled, simple commands or pipelines preceded by a a semicolon (\fB;\fR) 5937 is displayed as if the \fBxtrace\fR option were enabled but is not executed. 5938 Otherwise, the leading \fB;\fR is ignored. 5939 .RE 5940 5941 .sp 5942 .ne 2 5943 .na 5944 \fB\fBtrackall\fR\fR 5945 .ad 5946 .sp .6 5947 .RS 4n 5948 Same as \fB-h\fR. 5949 .RE 5950 5951 .sp 5952 .ne 2 5953 .na 5954 \fB\fBverbose\fR\fR 5955 .ad 5956 .sp .6 5957 .RS 4n 5958 Same as \fB-v\fR. 5959 .RE 5960 5961 .sp 5962 .ne 2 5963 .na 5964 \fB\fBvi\fR\fR 5965 .ad 5966 .sp .6 5967 .RS 4n 5968 Puts you in insert mode of a \fBvi\fR style inline editor until you hit the 5969 escape character 033. This puts you in control mode. A return sends the line. 5970 .RE 5971 5972 .sp 5973 .ne 2 5974 .na 5975 \fB\fBviraw\fR\fR 5976 .ad 5977 .sp .6 5978 .RS 4n 5979 Each character is processed as it is typed in \fBvi\fR mode. 5980 .RE 5981 5982 .sp 5983 .ne 2 5984 .na 5985 \fB\fBxtrace\fR\fR 5986 .ad 5987 .sp .6 5988 .RS 4n 5989 Same as \fB-x\fR. 5990 .sp 5991 If no option name is supplied, the current options settings are printed. 5992 .RE 5993 5994 .RE 5995 5996 .sp 5997 .ne 2 5998 .na 5999 \fB\fB-p\fR\fR 6000 .ad 6001 .sp .6 6002 .RS 4n 6003 Disables processing of the \fB$HOME/.profile\fR file and uses the file 6004 \fB/etc/suid_profile\fR instead of the \fBENV\fR file. This mode is on whenever 6005 the effective \fBuid\fR (\fBgid\fR) is not equal to the real \fBuid\fR 6006 (\fBgid\fR). Turning this off causes the effective \fBuid\fR and \fBgid\fR to 6007 be set to the real \fBuid\fR and \fBgid\fR. 6008 .RE 6009 6010 .sp 6011 .ne 2 6012 .na 6013 \fB\fB-r\fR\fR 6014 .ad 6015 .sp .6 6016 .RS 4n 6017 Enables the restricted shell. This option cannot be unset once set. 6018 .RE 6019 6020 .sp 6021 .ne 2 6022 .na 6023 \fB\fB-s\fR\fR 6024 .ad 6025 .sp .6 6026 .RS 4n 6027 Sort the positional parameters lexicographically. 6028 .RE 6029 6030 .sp 6031 .ne 2 6032 .na 6033 \fB\fB-t\fR\fR 6034 .ad 6035 .sp .6 6036 .RS 4n 6037 Obsolete. Exit after reading and executing one command. 6038 .RE 6039 6040 .sp 6041 .ne 2 6042 .na 6043 \fB\fB-u\fR\fR 6044 .ad 6045 .sp .6 6046 .RS 4n 6047 Treat \fBunset\fR parameters as an error when substituting. 6048 .RE 6049 6050 .sp 6051 .ne 2 6052 .na 6053 \fB\fB-v\fR\fR 6054 .ad 6055 .sp .6 6056 .RS 4n 6057 Print shell input lines as they are read. 6058 .RE 6059 6060 .sp 6061 .ne 2 6062 .na 6063 \fB\fB-x\fR\fR 6064 .ad 6065 .sp .6 6066 .RS 4n 6067 Print commands and their arguments as they are executed. 6068 .RE 6069 6070 .sp 6071 .ne 2 6072 .na 6073 \fB\fB--\fR\fR 6074 .ad 6075 .sp .6 6076 .RS 4n 6077 Do not change any of the options. This is useful in setting \fB$1\fR to a value 6078 beginning with \fB-\fR. If no arguments follow this option then the positional 6079 parameters are unset. 6080 .RE 6081 6082 As an obsolete feature, if the first \fIarg\fR is - then the \fB-x\fR and 6083 \fB-v\fR options are turned off and the next \fIarg\fR is treated as the first 6084 argument. Using \fB+\fR rather than \fB-\fR causes these options to be turned 6085 off. These options can also be used upon invocation of the shell. The current 6086 set of options can be found in \fB$-\fR. Unless \fB-A\fR is specified, the 6087 remaining arguments are positional parameters and are assigned, in order, to 6088 \fB$1 $2 \&....\fR If no arguments are specified, then the names and values of 6089 all variables are printed on the standard output. 6090 .RE 6091 6092 .sp 6093 .ne 2 6094 .na 6095 \fB\fB+shift\fR \fB[\fR\fIn\fR\fB]\fR\fR 6096 .ad 6097 .sp .6 6098 .RS 4n 6099 The positional parameters from \fB$\fR\fIn\fR\fB+1 ...\fR are renamed 6100 \fB$1 ...\fR, the default \fIn\fR is \fB1\fR. The parameter \fIn\fR can be any 6101 arithmetic expression that evaluates to a non-negative number less than or 6102 equal to \fB$#\fR. 6103 .RE 6104 6105 .sp 6106 .ne 2 6107 .na 6108 \fB\fBsleep\fR \fIseconds\fR\fR 6109 .ad 6110 .sp .6 6111 .RS 4n 6112 Suspends execution for the number of decimal seconds or fractions of a second 6113 specified by \fIseconds\fR. 6114 .RE 6115 6116 .sp 6117 .ne 2 6118 .na 6119 \fB\fB+trap\fR \fB-p\fR \fB[\fR\fIaction\fR\fB]\fR 6120 \fB[\fR\fIsig\fR\fB] ...\fR\fR 6121 .ad 6122 .sp .6 6123 .RS 4n 6124 The \fB-p\fR option causes the trap action associated with each trap as 6125 specified by the arguments to be printed with appropriate quoting. Otherwise, 6126 \fIaction\fR is processed as if it were an argument to \fBeval\fR when the 6127 shell receives signal(s) \fIsig\fR. Each \fIsig\fR can be specified as a number 6128 or as the name of the signal. Trap commands are executed in order of signal 6129 number. Any attempt to set a trap on a signal that was ignored on entry to the 6130 current shell is ineffective. If \fIaction\fR is omitted and the first 6131 \fIsig\fR is a number, or if \fIaction\fR is \fB-\fR, then the trap(s) for each 6132 \fIsig\fR are reset to their original values. If \fIaction\fR is the null 6133 string then this signal is ignored by the shell and by the commands it invokes. 6134 If \fIsig\fR is \fBERR\fR then \fIaction\fR is executed whenever a command has 6135 a \fBnon-zero\fR exit status. If \fIsig\fR is \fBDEBUG\fR then \fIaction\fR is 6136 executed before each command. The variable \fB\&.sh.command\fR contains the 6137 contents of the current command line when \fIaction\fR is running. If \fIsig\fR 6138 is \fB0\fR or \fBEXIT\fR and the trap statement is executed inside the body of 6139 a function defined with the \fBfunction\fR \fIname\fR syntax, then the command 6140 \fIaction\fR is executed after the function completes. If \fIsig\fR is \fB0\fR 6141 or \fBEXIT\fR for a trap set outside any function then the command \fIaction\fR 6142 is executed on exit from the shell. If \fIsig\fR is \fBKEYBD\fR, then 6143 \fIaction\fR is executed whenever a key is read while in \fBemacs\fR, 6144 \fBgmacs\fR, or \fBvi\fR mode. The \fBtrap\fR command with no arguments prints 6145 a list of commands associated with each signal number. 6146 .RE 6147 6148 .sp 6149 .ne 2 6150 .na 6151 \fB\fBtrue\fR\fR 6152 .ad 6153 .sp .6 6154 .RS 4n 6155 Does nothing, and exits \fB0\fR. Used with while for infinite loops. 6156 .RE 6157 6158 .sp 6159 .ne 2 6160 .na 6161 \fB\fB++typeset [\(+-AHflabnprtux ] [ \(+-EFLRZi[\fR\fIn\fR\fB] ] [\fR 6162 \fIvname\fR\fB[=\fR\fIvalue\fR \fB] ]\fR\fR 6163 .ad 6164 .sp .6 6165 .RS 4n 6166 Sets attributes and values for shell variables and functions. When invoked 6167 inside a function defined with the \fBfunction\fR \fIname\fR syntax, a new 6168 instance of the variable \fIvname\fR is created, and the variable's value and 6169 type are restored when the function completes. 6170 .sp 6171 Using \fB+\fR rather than \fB-\fR causes these options to be turned off. If no 6172 \fIvname\fR arguments are specified, a list of \fIvname\fRs (and optionally the 6173 \fIvalue\fRs) of the variables is printed. Using \fB+\fR rather than \fB-\fR 6174 keeps the values from being printed.) The \fB-p\fR option causes \fBtypeset\fR 6175 followed by the option letters to be printed before each name rather than the 6176 names of the options. If any option other than \fB-p\fR is specified, only 6177 those variables which have all of the specified options are printed. Otherwise, 6178 the \fIvname\fRs and \fIattributes\fR of all variables that have attributes are 6179 printed. 6180 .sp 6181 The following list of attributes can be specified: 6182 .sp 6183 .ne 2 6184 .na 6185 \fB\fB-a\fR\fR 6186 .ad 6187 .RS 6n 6188 Declares \fIvname\fR to be an indexed array. This is optional unless except for 6189 compound variable assignments. 6190 .RE 6191 6192 .sp 6193 .ne 2 6194 .na 6195 \fB\fB-A\fR\fR 6196 .ad 6197 .RS 6n 6198 Declares \fIvname\fR to be an associative array. Sub-scripts are strings rather 6199 than arithmetic expressions. 6200 .RE 6201 6202 .sp 6203 .ne 2 6204 .na 6205 \fB\fB-b\fR\fR 6206 .ad 6207 .RS 6n 6208 The variable can hold any number of bytes of data. The data can be text or 6209 binary. The value is represented by the \fBbase64\fR encoding of the data. If 6210 \fB-Z\fR is also specified, the size in bytes of the data in the buffer is 6211 determined by the size associated with the \fB-Z\fR. If the \fBbase64\fR string 6212 assigned results in more data, it is truncated. Otherwise, it is filled with 6213 bytes whose value is zero. The \fBprintf\fR format \fB%B\fR can be used to 6214 output the actual data in this buffer instead of the \fBbase64\fR encoding of 6215 the data. 6216 .RE 6217 6218 .sp 6219 .ne 2 6220 .na 6221 \fB\fB-E\fR\fR 6222 .ad 6223 .RS 6n 6224 Declares \fIvname\fR to be a double precision floating point number. If \fIn\fR 6225 is \fBnon-zero\fR, it defines the number of significant figures that are used 6226 when expanding \fIvname\fR. Otherwise, ten significant figures is used. 6227 .RE 6228 6229 .sp 6230 .ne 2 6231 .na 6232 \fB\fB-f\fR\fR 6233 .ad 6234 .RS 6n 6235 The names refer to function names rather than variable names. No assignments 6236 can be made and the only other valid options are \fB-t\fR, \fB-u\fR, and 6237 \fB-x.\fR The \fB-t\fR option turns on execution tracing for this function. The 6238 \fB-u\fR option causes this function to be marked undefined. The \fBFPATH\fR 6239 variable is searched to find the function definition when the function is 6240 referenced. If no options other than \fB-f\fR is specified, then the function 6241 definition is displayed on standard output. If \fB+f\fR is specified, then a 6242 line containing the function name followed by a shell comment containing the 6243 line number and path name of the file where this function was defined, if any, 6244 is displayed. 6245 .sp 6246 The \fB-i\fR attribute cannot be specified with \fB-f\fR. 6247 .RE 6248 6249 .sp 6250 .ne 2 6251 .na 6252 \fB\fB-F\fR\fR 6253 .ad 6254 .RS 6n 6255 Declares \fIvname\fR to be a double precision floating point number. If \fIn\fR 6256 is \fBnon-zero\fR, it defines the number of places after the decimal point that 6257 are used when expanding \fIvname\fR. Otherwise ten places after the decimal 6258 point is used. 6259 .RE 6260 6261 .sp 6262 .ne 2 6263 .na 6264 \fB\fB-H\fR\fR 6265 .ad 6266 .RS 6n 6267 This option provides UNIX to hostname file mapping on non-UNIX machines. 6268 .RE 6269 6270 .sp 6271 .ne 2 6272 .na 6273 \fB\fB-i\fR\fR 6274 .ad 6275 .RS 6n 6276 Declares \fIvname\fR to be represented internally as integer. The right hand 6277 side of an assignment is evaluated as an arithmetic expression when assigning 6278 to an integer. If \fIn\fR is \fBnon-zero\fR, it defines the output arithmetic 6279 base, otherwise the output base is ten. 6280 .sp 6281 The \fB-i\fR attribute cannot be specified along with \fB-R\fR, \fB-L\fR, 6282 \fB-Z\fR, or \fB-f\fR. 6283 .RE 6284 6285 .sp 6286 .ne 2 6287 .na 6288 \fB\fB-l\fR\fR 6289 .ad 6290 .RS 6n 6291 All uppercase characters are converted to lowercase. The uppercase option, 6292 \fB-u\fR, is turned off. 6293 .RE 6294 6295 .sp 6296 .ne 2 6297 .na 6298 \fB\fB-L\fR\fR 6299 .ad 6300 .RS 6n 6301 Left justify and remove leading blanks from \fIvalue\fR. If \fIn\fR is 6302 \fBnon-zero\fR, it defines the width of the field, otherwise it is determined 6303 by the width of the value of first assignment. When the variable is assigned 6304 to, it is filled on the right with blanks or truncated, if necessary, to fit 6305 into the field. The \fB-R\fR option is turned off. 6306 .sp 6307 The \fB-i\fR attribute cannot be specified with \fB-L\fR. 6308 .RE 6309 6310 .sp 6311 .ne 2 6312 .na 6313 \fB\fB-n\fR\fR 6314 .ad 6315 .RS 6n 6316 Declares \fIvname\fR to be a reference to the variable whose name is defined by 6317 the value of variable \fIvname\fR. This is usually used to reference a variable 6318 inside a function whose name has been passed as an argument. 6319 .RE 6320 6321 .sp 6322 .ne 2 6323 .na 6324 \fB\fB-R\fR\fR 6325 .ad 6326 .RS 6n 6327 Right justify and fill with leading blanks. If \fIn\fR is \fBnon-zero\fR, it 6328 defines the width of the field, otherwise it is determined by the width of the 6329 value of first assignment. The field is left filled with blanks or truncated 6330 from the end if the variable is reassigned. The \fB-L\fR option is turned off. 6331 .sp 6332 The \fB-i\fR attribute cannot be specified with \fB-R\fR. 6333 .RE 6334 6335 .sp 6336 .ne 2 6337 .na 6338 \fB\fB-r\fR\fR 6339 .ad 6340 .RS 6n 6341 The specified \fIvname\fRs are marked read-only and these names cannot be 6342 changed by subsequent assignment. 6343 .RE 6344 6345 .sp 6346 .ne 2 6347 .na 6348 \fB\fB-t\fR\fR 6349 .ad 6350 .RS 6n 6351 Tags the variables. Tags are user definable and have no special meaning to the 6352 shell. 6353 .RE 6354 6355 .sp 6356 .ne 2 6357 .na 6358 \fB\fB-u\fR\fR 6359 .ad 6360 .RS 6n 6361 All lowercase characters are converted to uppercase. The lowercase option, 6362 \fB-l\fR, is turned off. 6363 .RE 6364 6365 .sp 6366 .ne 2 6367 .na 6368 \fB\fB-x\fR\fR 6369 .ad 6370 .RS 6n 6371 The specified \fIvname\fRs are marked for automatic export to the environment 6372 of subsequently-executed commands. Variables whose names contain a . cannot be 6373 exported. 6374 .RE 6375 6376 .sp 6377 .ne 2 6378 .na 6379 \fB\fB-Z\fR\fR 6380 .ad 6381 .RS 6n 6382 Right justify and fill with leading zeros if the first non-blank character is a 6383 digit and the \fB-L\fR option has not been set. Remove leading zeros if the 6384 \fB-L\fR option is also set. If \fIn\fR is \fBnon-zero\fR, it defines the width 6385 of the field, otherwise it is determined by the width of the value of first 6386 assignment. 6387 .sp 6388 The \fB-i\fR attribute cannot be specified with \fB-Z\fR. 6389 .RE 6390 6391 .RE 6392 6393 .sp 6394 .ne 2 6395 .na 6396 \fB\fBulimit [\fR\fB-HSacdfmnpstv\fR\fB] [\fR \fIlimit\fR\fB]\fR\fR 6397 .ad 6398 .sp .6 6399 .RS 4n 6400 Set or display a resource limit. Many systems do not support one or more of 6401 these limits. The limit for a specified resource is set when \fIlimit\fR is 6402 specified. The value of \fIlimit\fR can be a number in the unit specified with 6403 each resource, or the value unlimited. When more than one resource is 6404 specified, then the limit name and unit is printed before the value. 6405 .sp 6406 If no option is specified, \fB-f\fR is assumed. 6407 .sp 6408 The following are the available resource limits: 6409 .sp 6410 .ne 2 6411 .na 6412 \fB\fB-a\fR\fR 6413 .ad 6414 .RS 6n 6415 Lists all of the current resource limits. 6416 .RE 6417 6418 .sp 6419 .ne 2 6420 .na 6421 \fB\fB-c\fR\fR 6422 .ad 6423 .RS 6n 6424 The number of 512-byte blocks on the size of core dumps. 6425 .RE 6426 6427 .sp 6428 .ne 2 6429 .na 6430 \fB\fB-d\fR\fR 6431 .ad 6432 .RS 6n 6433 The number of Kbytes on the size of the data area. 6434 .RE 6435 6436 .sp 6437 .ne 2 6438 .na 6439 \fB\fB-f\fR\fR 6440 .ad 6441 .RS 6n 6442 The number of 512-byte blocks on files that can be written by the current 6443 process or by child processes (files of any size can be read). 6444 .RE 6445 6446 .sp 6447 .ne 2 6448 .na 6449 \fB\fB-H\fR\fR 6450 .ad 6451 .RS 6n 6452 Specifies a hard limit for the specified resource. 6453 .sp 6454 A hard limit cannot be increased once it is set. 6455 .sp 6456 If neither the \fB-H\fR nor \fB-S\fR option is specified, the limit applies to 6457 both. The current resource limit is printed when \fIlimit\fR is omitted. In 6458 this case, the soft limit is printed unless \fB-H\fR is specified. 6459 .RE 6460 6461 .sp 6462 .ne 2 6463 .na 6464 \fB\fB-m\fR\fR 6465 .ad 6466 .RS 6n 6467 The number of Kbytes on the size of physical memory. 6468 .RE 6469 6470 .sp 6471 .ne 2 6472 .na 6473 \fB\fB-n\fR\fR 6474 .ad 6475 .RS 6n 6476 The number of file descriptors plus 1. 6477 .RE 6478 6479 .sp 6480 .ne 2 6481 .na 6482 \fB\fB-p\fR\fR 6483 .ad 6484 .RS 6n 6485 The number of 512-byte blocks for pipe buffering. 6486 .RE 6487 6488 .sp 6489 .ne 2 6490 .na 6491 \fB\fB-s\fR\fR 6492 .ad 6493 .RS 6n 6494 The number of Kbytes on the size of the stack area. 6495 .RE 6496 6497 .sp 6498 .ne 2 6499 .na 6500 \fB\fB-S\fR\fR 6501 .ad 6502 .RS 6n 6503 Specifies a soft limit for the specified resource. 6504 .sp 6505 A soft limit can be increased up to the value of the hard limit. 6506 .sp 6507 If neither the \fB-H\fR nor \fB-S\fR option is specified, the limit applies to 6508 both. The current resource limit is printed when \fIlimit\fR is omitted. In 6509 this case, the soft limit is printed unless \fB-H\fR is specified. 6510 .RE 6511 6512 .sp 6513 .ne 2 6514 .na 6515 \fB\fB-t\fR\fR 6516 .ad 6517 .RS 6n 6518 The number of CPU seconds to be used by each process. 6519 .RE 6520 6521 .sp 6522 .ne 2 6523 .na 6524 \fB\fB-v\fR\fR 6525 .ad 6526 .RS 6n 6527 The number of Kbytes for virtual memory. 6528 .RE 6529 6530 .RE 6531 6532 .sp 6533 .ne 2 6534 .na 6535 \fB\fBumask\fR \fB[\fR\fB-S\fR\fB]\fR\fB[\fR\fImask\fR\fB]\fR\fR 6536 .ad 6537 .sp .6 6538 .RS 4n 6539 The user file-creation mask is set to \fImask\fR. \fImask\fR can either be an 6540 octal number or a symbolic value as described in \fBchmod\fR(1). 6541 .sp 6542 If a symbolic value is specified, the new \fBumask\fR value is the complement 6543 of the result of applying \fImask\fR to the complement of the previous 6544 \fBumask\fR value. If \fImask\fR is omitted, the current value of the mask is 6545 printed. The \fB-S\fR option causes the mode to be printed as a symbolic value. 6546 Otherwise, the mask is printed in octal. 6547 .sp 6548 See \fBumask\fR(2) 6549 .RE 6550 6551 .sp 6552 .ne 2 6553 .na 6554 \fB\fB+unalias\fR \fB[\fR\fB-a\fR\fB]\fR \fIname\fR\fR 6555 .ad 6556 .sp .6 6557 .RS 4n 6558 The aliases specified by the list of \fIname\fRs are removed from the alias 6559 list. The \fB-a\fR option causes all the aliases to be unset. 6560 .RE 6561 6562 .sp 6563 .ne 2 6564 .na 6565 \fB\fB+unset\fR \fB[\fR\fB-fnv\fR\fB]\fR \fIvname\fR\fR 6566 .ad 6567 .sp .6 6568 .RS 4n 6569 The variables specified by the list of \fIvname\fRs are unassigned, i.e., their 6570 values and attributes are erased. Read-only variables cannot be unset. If the 6571 \fB-f\fR option is set, then the names refer to function names. If the \fB-v\fR 6572 option is set, then the names refer to variable names. The \fB-f\fR option 6573 overrides \fB-v\fR. If \fB-n\fR is set and \fIname\fR is a name reference, then 6574 \fIname\fR is unset rather than the variable that it references. The default is 6575 equivalent to \fB-v\fR. Unsetting \fBLINENO\fR, \fBMAILCHECK\fR, \fBOPTARG\fR, 6576 \fBOPTIND\fR, \fBRANDOM\fR, \fBSECONDS\fR, \fBTMOUT\fR, and \fB_\fR removes 6577 their special meaning even if they are subsequently assigned to. 6578 .RE 6579 6580 .sp 6581 .ne 2 6582 .na 6583 \fB\fBwait\fR \fB[\fR\fIjob\fR\fB]\fR\fR 6584 .ad 6585 .sp .6 6586 .RS 4n 6587 Wait for the specified job and report its termination status. If \fIjob\fR is 6588 not specified, then all currently active child processes are waited for. The 6589 exit status from this command is that of the last process waited for if 6590 \fIjob\fR is specified; otherwise it is zero. See \fBJobs\fR for a description 6591 of the format of \fIjob\fR. 6592 .RE 6593 6594 .sp 6595 .ne 2 6596 .na 6597 \fB\fBwhence\fR \fB[\fR\fB-afpv\fR\fB]\fR \fIname ...\fR\fR 6598 .ad 6599 .sp .6 6600 .RS 4n 6601 For each \fIname\fR, indicate how it would be interpreted if used as a command 6602 name. The \fB-v\fR option produces a more verbose report. The \fB-f\fR option 6603 skips the search for functions. The \fB-p\fR option does a path search for 6604 \fIname\fR even if name is an alias, a function, or a reserved word. The 6605 \fB-a\fR option is similar to the -v option but causes all interpretations of 6606 the specified name to be reported. 6607 .RE 6608 6609 .SS "Invocation" 6610 .LP 6611 If the shell is invoked by \fBexec\fR(2), and the first character of argument 6612 zero (\fB$0\fR) is \fB-\fR, then the shell is assumed to be a login shell and 6613 commands are read from \fB/etc/profile\fR and then from either .\fBprofile\fR 6614 in the current directory or \fB$HOME/.profile\fR, if either file exists. Next, 6615 for interactive shells, commands are read first from \fB/etc/ksh.kshrc\fR, and 6616 then from the file named by performing parameter expansion, command 6617 substitution, and arithmetic substitution on the value of the environment 6618 variable \fBENV\fR if the file exists. If the \fB-s\fR option is not present 6619 and \fIarg\fR and a file by the name of \fIarg\fR exists, then it reads and 6620 executes this script. Otherwise, if the first \fIarg\fR does not contain a 6621 \fB/\fR, a path search is performed on the first \fIarg\fR to determine the 6622 name of the script to execute. The script \fIarg\fR must have execute 6623 permission and any \fBsetuid\fR and \fBsetgid\fR settings are ignored. If the 6624 script is not found on the path, \fIarg\fR is processed as if it named a 6625 built-in command or function. 6626 .sp 6627 .LP 6628 Commands are then read as described, and the following options are interpreted 6629 by the shell when it is invoked: 6630 .sp 6631 .ne 2 6632 .na 6633 \fB\fB-c\fR\fR 6634 .ad 6635 .RS 15n 6636 If the \fB-c\fR option is present, then commands are read from the first 6637 \fIarg\fR. Any remaining arguments become positional parameters starting at 6638 \fB0\fR. 6639 .RE 6640 6641 .sp 6642 .ne 2 6643 .na 6644 \fB\fB-D\fR\fR 6645 .ad 6646 .RS 15n 6647 A list of all double quoted strings that are preceded by a \fB$\fR is printed 6648 on standard output and the shell exits. This set of strings is subject to 6649 language translation when the locale is not C or POSIX. No commands are 6650 executed. 6651 .RE 6652 6653 .sp 6654 .ne 2 6655 .na 6656 \fB\fB-i\fR\fR 6657 .ad 6658 .RS 15n 6659 If the \fB-i\fR option is present or if the shell input and output are attached 6660 to a terminal (as told by \fBtcgetattr\fR(3C), this shell is interactive. In 6661 this case \fBTERM\fR is ignored (so that \fBkill 0\fR does not kill an 6662 interactive shell) and \fBINTR\fR is caught and ignored (so that wait is 6663 interruptible). In all cases, \fBQUIT\fR is ignored by the shell. 6664 .RE 6665 6666 .sp 6667 .ne 2 6668 .na 6669 \fB\fB-R\fR \fIfilename\fR\fR 6670 .ad 6671 .RS 15n 6672 The \fB-R\fR \fIfilename\fR option is used to generate a cross reference 6673 database that can be used by a separate utility to find definitions and 6674 references for variables and commands. 6675 .RE 6676 6677 .sp 6678 .ne 2 6679 .na 6680 \fB\fB-r\fR\fR 6681 .ad 6682 .RS 15n 6683 If the \fB-r\fR option is present, the shell is a restricted shell. 6684 .RE 6685 6686 .sp 6687 .ne 2 6688 .na 6689 \fB\fB-s\fR\fR 6690 .ad 6691 .RS 15n 6692 If the \fB-s\fR option is present or if no arguments remain, then commands are 6693 read from the standard input. Shell output, except for the output of the 6694 \fBSpecial Commands\fR listed, is written to file descriptor 2. 6695 .RE 6696 6697 .sp 6698 .LP 6699 The remaining options and arguments are described under the \fBset\fR command. 6700 An optional \fB-\fR as the first argument is ignored. 6701 .SS "\fBrksh93\fR Only" 6702 .LP 6703 \fBrksh93\fR is used to set up login names and execution environments whose 6704 capabilities are more controlled than those of the standard shell. 6705 .sp 6706 .LP 6707 The actions of \fBrksh93\fR are identical to those of \fBksh93\fR, except that 6708 the following are disallowed: 6709 .RS +4 6710 .TP 6711 .ie t \(bu 6712 .el o 6713 Unsetting the restricted option 6714 .RE 6715 .RS +4 6716 .TP 6717 .ie t \(bu 6718 .el o 6719 Changing directory. See \fBcd\fR(1). 6720 .RE 6721 .RS +4 6722 .TP 6723 .ie t \(bu 6724 .el o 6725 Setting or unsetting the value or attributes of \fBSHELL\fR, \fBENV\fR, 6726 \fBFPATH\fR, or \fBPATH\fR 6727 .RE 6728 .RS +4 6729 .TP 6730 .ie t \(bu 6731 .el o 6732 Specifying path or command names containing \fB/\fR, 6733 .RE 6734 .RS +4 6735 .TP 6736 .ie t \(bu 6737 .el o 6738 Redirecting output (\fB>\fR, \fB>\fR\fB|\fR, \fB<>\fR, and \fB>>\fR). 6739 .RE 6740 .RS +4 6741 .TP 6742 .ie t \(bu 6743 .el o 6744 Adding or deleting built-in commands. 6745 .RE 6746 .RS +4 6747 .TP 6748 .ie t \(bu 6749 .el o 6750 Using \fBcommand\fR \fB-p\fR to invoke a command. 6751 .RE 6752 .sp 6753 .LP 6754 These restrictions are enforced after .\fBprofile\fR and the \fBENV\fR files 6755 are interpreted. 6756 .sp 6757 .LP 6758 When a command to be executed is found to be a shell procedure, \fBrksh93\fR 6759 invokes \fBksh93\fR to execute it. Thus, it is possible to provide to the 6760 end-user shell procedures that have access to the full power of the standard 6761 shell, while imposing a limited menu of commands. This scheme assumes that the 6762 end-user does not have write and execute permissions in the same directory. The 6763 net effect of these rules is that the writer of the .\fBprofile\fR has complete 6764 control over user actions, by performing guaranteed setup actions and leaving 6765 the user in an appropriate directory (probably not the login directory). The 6766 system administrator often sets up a directory of commands, for example, 6767 \fB/usr/rbin\fR, that can be safely invoked by \fBrksh\fR. 6768 .SH USAGE 6769 .LP 6770 See \fBlargefile\fR(5) for the description of the behavior of \fBksh93\fR and 6771 \fBrksh93\fR when encountering files greater than or equal to 2 Gbyte ( 2^31 6772 bytes). 6773 .SH EXIT STATUS 6774 .LP 6775 The following exit values are returned: 6776 .sp 6777 .ne 2 6778 .na 6779 \fB\fBnon-zero\fR\fR 6780 .ad 6781 .sp .6 6782 .RS 4n 6783 Returns \fBnon-zero\fR when errors, such as syntax errors, are detected by the 6784 shell. 6785 .sp 6786 If the shell is being used non-interactively, then execution of the shell file 6787 is abandoned unless the error occurs inside a sub-shell in which case the 6788 sub-shell is abandoned. 6789 .RE 6790 6791 .sp 6792 .ne 2 6793 .na 6794 \fB\fIexit status of last command executed\fR\fR 6795 .ad 6796 .sp .6 6797 .RS 4n 6798 Returns the exit status of the last command executed. 6799 .sp 6800 Run time errors detected by the shell are reported by printing the command or 6801 function name and the error condition. If the line number that the error 6802 occurred on is greater than one, then the line number is also printed in square 6803 brackets (\fB[]\fR) after the command or function name. 6804 .sp 6805 See the \fBksh93 exit\fR command for additional details. 6806 .RE 6807 6808 .SH FILES 6809 .ne 2 6810 .na 6811 \fB\fB/etc/profile\fR\fR 6812 .ad 6813 .sp .6 6814 .RS 4n 6815 The system initialization file, executed for login shells. 6816 .RE 6817 6818 .sp 6819 .ne 2 6820 .na 6821 \fB\fB/etc/ksh.kshrc\fR\fR 6822 .ad 6823 .sp .6 6824 .RS 4n 6825 The system wide startup file, executed for interactive shells. 6826 .RE 6827 6828 .sp 6829 .ne 2 6830 .na 6831 \fB\fB$HOME/.profile\fR\fR 6832 .ad 6833 .sp .6 6834 .RS 4n 6835 The personal initialization file, executed for login shells after 6836 \fB/etc/profile\fR. 6837 .RE 6838 6839 .sp 6840 .ne 2 6841 .na 6842 \fB\fB$HOME/.kshrc\fR\fR 6843 .ad 6844 .sp .6 6845 .RS 4n 6846 Default personal initialization file, executed after \fB/etc/ksh.kshrc\fR, for 6847 interactive shells when \fBENV\fR is not set. 6848 .RE 6849 6850 .sp 6851 .ne 2 6852 .na 6853 \fB\fB/etc/suid-profile\fR\fR 6854 .ad 6855 .sp .6 6856 .RS 4n 6857 Alternative initialization file, executed instead of the personal 6858 initialization file when the real and effective user or group id do not match. 6859 .RE 6860 6861 .sp 6862 .ne 2 6863 .na 6864 \fB\fB/dev/null\fR\fR 6865 .ad 6866 .sp .6 6867 .RS 4n 6868 NULL device. 6869 .RE 6870 6871 .SH AUTHORS 6872 .LP 6873 David Korn, \fBdgk@research.att.com\fR 6874 .SH ATTRIBUTES 6875 .LP 6876 See \fBattributes\fR(5) for descriptions of the following attributes: 6877 .sp 6878 6879 .sp 6880 .TS 6881 box; 6882 c | c 6883 l | l . 6884 ATTRIBUTE TYPE ATTRIBUTE VALUE 6885 _ 6886 Interface Stability See below. 6887 .TE 6888 6889 .sp 6890 .LP 6891 The scripting interface is Uncommitted. The environment variables, 6892 \fB\&.paths\fR feature, and editing modes are Volatile. 6893 .SH SEE ALSO 6894 .LP 6895 \fBcat\fR(1), \fBcd\fR(1), \fBchmod\fR(1), \fBcut\fR(1), \fBdate\fR(1), 6896 \fBegrep\fR(1), \fBecho\fR(1), \fBegrep\fR(1), \fBenv\fR(1), \fBfgrep\fR(1), 6897 \fBgrep\fR(1), \fBlogin\fR(1), \fBnewgrp\fR(1), \fBpaste\fR(1), 6898 \fBprintf\fR(1), \fBstty\fR(1), \fBtest\fR(1), \fBumask\fR(1), \fBvi\fR(1), 6899 \fBdup\fR(2), \fBexec\fR(2), \fBfork\fR(2), \fBioctl\fR(2), \fBlseek\fR(2), 6900 \fBpathconf\fR(2), \fBpipe\fR(2), \fBsysconf\fR(3C), \fBulimit\fR(2), 6901 \fBumask\fR(2), \fBrand\fR(3C), \fBtcgetattr\fR(3C), \fBwait\fR(3C), 6902 \fBa.out\fR(4), \fBprofile\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), 6903 \fBlargefile\fR(5), \fBstandards\fR(5) 6904 .sp 6905 .LP 6906 Bolsky, Morris I. and Korn, David G., \fIThe New KornShell Command and 6907 Programming Language\fR, Prentice Hall, 1995. 6908 .sp 6909 .LP 6910 \fIPOSIX-Part 2: Shell and Utilities, IEEE Std 1003.2-1992, ISO/IEC 9945-2\fR, 6911 IEEE, 1993. 6912 .SH NOTES 6913 .LP 6914 \fBksh93\fR scripts should choose shell function names outside the namespace 6915 used by reserved keywords of the ISO C99, C++ and JAVA languages to avoid 6916 collisions with future enhancements to \fBksh93\fR. 6917 .sp 6918 .LP 6919 If a command is executed, and then a command with the same name is installed in 6920 a directory in the search path before the directory where the original command 6921 was found, the shell continues to \fBexec\fR the original command. Use the 6922 \fB-t\fR option of the alias command to correct this situation. 6923 .sp 6924 .LP 6925 Some very old shell scripts contain a caret (\fB^\fR) as a synonym for the pipe 6926 character (\fB|\fR). 6927 .sp 6928 .LP 6929 Using the \fBhist\fR built-in command within a compound command causes the 6930 whole command to disappear from the history file. 6931 .sp 6932 .LP 6933 The built-in command \fB\&.\fR \fIfile\fR reads the whole file before any 6934 commands are executed. \fBalias\fR and \fBunalias\fR commands in the file do 6935 not apply to any commands defined in the file. 6936 .sp 6937 .LP 6938 Traps are not processed while a job is waiting for a foreground process. Thus, 6939 a trap on \fBCHLD\fR is not executed until the foreground job terminates. 6940 .sp 6941 .LP 6942 It is a good idea to leave a space after the comma operator in arithmetic 6943 expressions to prevent the comma from being interpreted as the decimal point 6944 character in certain locales. 6945 .sp 6946 .LP 6947 There might be some restrictions on creating a \fB\&.paths\fR file which is 6948 portable across other operating systems. 6949 .sp 6950 .LP 6951 If the system supports the 64-bit instruction set, \fB/bin/ksh93\fR executes 6952 the 64-bit version of \fBksh93\fR.