1.\" 2.\" Copyright (c) 1980, 1990, 1993 3.\" The Regents of the University of California. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. Neither the name of the University nor the names of its contributors 14.\" may be used to endorse or promote products derived from this software 15.\" without specific prior written permission. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\" 29.\" - Indent in multiples of 4, usually 8. 30.\" 31.\" - Use \` for literal back-quote (`). 32.\" 33.\" - Use \e for literal backslash (\). 34.\" 35.\" - Use \-, not -. 36.\" 37.\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login 38.\" 39.\" - Refer to external commands in man page format, e.g., .Xr csh 1 40.\" However, tcsh is .Nm , because this is the tcsh man page (and 41.\" see the next note anyway). 42.\" 43.\" - Say .Sq the shell , not .Sq tcsh , 44.\" unless distinguishing between tcsh and csh. 45.\" 46.\" - Say .Sq shell variable / .Sq environment variable instead of 47.\" .Sq variable and .Sq builtin command / .Sq editor command instead of 48.\" .Sq builtin or .Sq command 49.\" unless the distinction is absolutely clear from context. 50.\" 51.\" - Use the simple present tense. 52.\" .Sq The shell uses , not .Sq The shell will use 53.\" 54.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables, 55.\" etc. in the reference section should be mentioned in the appropriate 56.\" descriptive section, or at least in the reference-section description 57.\" of another command (or whatever) which is mentioned in a description 58.\" section. Remember to note OS-specific things in "OS variant support", 59.\" new features in NEW FEATURES and referenced external commands in SEE 60.\" ALSO. 61.\" 62.\" - tcsh.man2html depends heavily on the specific nroff commands used in the 63.\" man page when the script was written. Please stick closely to the style 64.\" used here if you can. In particular, please don't use nroff commands 65.\" which aren't already used herein. 66.\" 67.Dd May 8, 2019 68.Dt TCSH 1 69.Os Astron 6.21.00 70.Sh NAME 71.Nm tcsh 72.Nd C shell with file name completion and command line editing 73.Sh SYNOPSIS 74.Nm 75.Op Fl bcdefFimnqstvVxX 76.Op Fl Dname Ns Op =value 77.Op Ar arg ... 78.Nm 79.Fl l 80.Ek 81.Sh DESCRIPTION 82.Nm 83is an enhanced but completely compatible version of the Berkeley 84UNIX C shell, 85.Xr csh 1 . 86It is a command language interpreter usable both as an interactive login 87shell and a shell script command processor. 88It includes a command-line editor (see 89.Sx The command-line editor ) 90programmable word completion (see 91.Sx Completion and listing ) 92spelling correction (see 93.Sx Spelling correction ) , 94a history mechanism (see 95.Sx History substitution ) , 96job control (see 97.Sx Jobs ) 98and a C-like syntax. 99The 100.Sx NEW FEATURES 101section describes major enhancements of 102.Nm 103over 104.Xr csh 1 . 105Throughout this manual, features of 106.Nm 107not found in most 108.Xr csh 1 109implementations 110(specifically, the 4.4BSD one) 111are labeled with 112.Sq (+) , 113and features which are present in 114.Xr csh 1 115but not usually documented are labeled with 116.Sq (u) . 117.Bl -tag 118.Ss Argument list processing 119If the first argument (argument 0) to the shell is 120.Sq \- 121then it is a login shell. 122A login shell can be also specified by invoking the shell with 123the 124.Fl l 125flag as the only argument. 126.Pp 127The rest of the flag arguments are interpreted as follows: 128.Bl -tag -width indent 129.It Fl b 130Forces a 131.Dq break 132from option processing, causing any 133further shell arguments to be treated as non-option arguments. 134The remaining arguments will not be interpreted as shell options. 135This may be used to pass options to a shell script without confusion 136or possible subterfuge. 137The shell will not run a set-user ID script without this option. 138.It Fl c 139Commands are read from the following argument (which must be present, and 140must be a single argument), 141stored in the 142.Va command 143shell variable for reference, and executed. 144Any remaining arguments are placed in the 145.Va argv 146shell variable. 147.It Fl d 148The shell loads the directory stack from 149.Pa ~/.cshdirs 150as described under 151.Sx Startup and shutdown , 152whether or not it is a login shell. (+) 153.It Fl Dname Ns Op =value 154Sets the environment variable 155.Va name 156.Dv value . 157(Domain/OS only) (+) 158.It Fl e 159The shell exits if any invoked command terminates abnormally or 160yields a non-zero exit status. 161.It Fl f 162The shell does not load any resource or startup files, or perform any 163command hashing, and thus starts faster. 164.It Fl F 165The shell uses 166.Xr fork 2 167instead of 168.Xr vfork 2 169to spawn processes. (+) 170.It Fl i 171The shell is interactive and prompts for its top-level input, even if 172it appears to not be a terminal. 173Shells are interactive without this option if 174their inputs and outputs are terminals. 175.It Fl l 176The shell is a login shell. 177Applicable only if 178.Fl l 179is the only 180flag specified. 181.It Fl m 182The shell loads 183.Pa ~/.tcshrc 184even if it does not belong to the effective user. 185Newer versions of 186.Xr su 1 187can pass 188.Fl m 189to the shell. (+) 190.It Fl n 191The shell parses commands but does not execute them. 192This aids in debugging shell scripts. 193.It Fl q 194The shell accepts SIGQUIT (see 195.Sx Signal handling ) 196and behaves when it is used under a debugger. 197Job control is disabled. (u) 198.It Fl s 199Command input is taken from the standard input. 200.It Fl t 201The shell reads and executes a single line of input. 202A 203.Sq \e 204may be used to 205escape the newline at the end of this line and continue onto another line. 206.It Fl v 207Sets the 208.Va verbose 209shell variable, so that 210command input is echoed after history substitution. 211.It Fl x 212Sets the 213.Va echo 214shell variable, so that commands are echoed 215immediately before execution. 216.It Fl V 217Sets the 218.Va verbose 219shell variable even before executing 220.Pa ~/.tcshrc . 221.It Fl X 222Is to 223.Fl x 224as 225.Fl V 226is to 227.Fl v . 228.TP 4 229.It Fl \-help 230Print a help message on the standard output and exit. (+) 231.It Fl \-version 232Print the version/platform/compilation options on the standard output and exit. 233This information is also contained in the 234.Va version 235shell variable. (+) 236.El 237.Pp 238After processing of flag arguments, if arguments remain but none of the 239.Fl c , 240.Fl i , 241.Fl s , 242or 243.Fl t 244options were given, the first argument is taken as the name of a file of 245commands, or 246.Dq script , 247to be executed. 248The shell opens this file and saves its name for possible 249resubstitution by 250.Sq $0 . 251Because many systems use either the standard 252version 6 or version 7 shells whose shell scripts are not compatible 253with this shell, the shell uses such a 254.Sq standard 255shell to execute a script 256whose first character is not a 257.Sq # , 258i.e., that does not start with a 259comment. 260.Pp 261Remaining arguments are placed in the 262.Va argv 263shell variable. 264.Ss Startup and shutdown 265A login shell begins by executing commands from the system files 266.Pa /etc/csh.cshrc 267and 268.Pa /etc/csh.login . 269It then executes commands from files in the user's 270.Pa home 271directory: 272first 273.Pa ~/.tcshrc (+) 274or, if 275.Pa ~/.tcshrc 276is not found, 277.Pa ~/.cshrc , 278then 279.Pa ~/.history 280(or the value of the 281.Va histfile 282shell variable), then 283.Pa ~/.login , 284and finally 285.Pa ~/.cshdirs 286(or the value of the 287.Va dirsfile 288shell variable) (+). 289The shell may read 290.Pa /etc/csh.login 291before instead of after 292.Pa /etc/csh.cshrc , 293and 294.Pa ~/.login 295before instead of after 296.Pa ~/.tcshrc 297or 298.Pa ~/.cshrc 299and 300.Pa ~/.history , 301if so compiled; 302see the 303.Va version 304shell variable. (+) 305.Pp 306Non-login shells read only 307.Pa /etc/csh.cshrc 308and 309.Pa ~/.tcshrc 310or 311.Pa ~/.cshrc 312on startup. 313.Pp 314For examples of startup files, please consult: 315.Lk http://tcshrc.sourceforge.net 316.Pp 317Commands like 318.Xr stty 1 319and 320.Xr tset 1 , 321which need be run only once per login, usually go in one's 322.Pa ~/.login 323file. 324Users who need to use the same set of files with both 325.Xr csh 1 326and 327.Nm 328can have only a 329.Pa ~/.cshrc 330which checks for the existence of the 331.Va tcsh 332shell variable (q.v.) before using 333.Nm \- 334specific commands, 335or can have both a 336.Pa ~/.cshrc 337and a 338.Pa ~/.tcshrc 339which 340.Ic sources 341(see the builtin command) 342.Pa ~/.cshrc . 343The rest of this manual uses 344.Pa ~/.tcshrc 345to mean 346.Pa ~/.tcshrc 347or, 348if 349.Pa ~/.tcshrc 350is not found, 351.Pa ~/.cshrc . 352.Pp 353In the normal case, the shell begins reading commands from the terminal, 354prompting with 355.Sq >\~ . 356(Processing of arguments and the use of the shell to 357process files containing command scripts are described later.) 358The shell repeatedly reads a line of command input, breaks it into words, 359places it on the command history list, parses it and executes each command 360in the line. 361.Pp 362One can log out by typing 363.Sq ^D 364on an empty line, 365.Sq logout 366or 367.Sq login 368or 369via the shell's autologout mechanism (see the 370.Va autologout 371shell variable). 372When a login shell terminates it sets the 373.Va logout 374shell variable to 375.Sq normal 376or 377.Sq automatic 378as appropriate, then executes commands from the files 379.Pa /etc/csh.logout 380and 381.Pa ~/.logout . 382The shell may drop DTR on logout 383if so compiled; see the 384.Va version 385shell variable. 386.Pp 387The names of the system login and logout files vary from system to system for 388compatibility with different 389.Xr csh 1 390variants; see 391.Sx FILES . 392.Ss Editing 393We first describe 394.Sx The command-line editor 395The 396.Sx Completion and listing 397and 398.Sx Spelling correction 399sections describe two sets of functionality that are implemented as editor 400commands but which deserve their own treatment. 401Finally, 402.Sx Editor commands 403lists and describes 404the editor commands specific to the shell and their default bindings. 405.Ss The command-line editor (+) 406Command-line input can be edited using key sequences much like those used in 407.Xr emacs 1 408or 409.Xr vi 1 . 410The editor is active only when the 411.Va edit 412shell variable is set, which it is by default in interactive shells. 413The 414.Ic bindkey 415builtin can display and change key bindings. 416.Xr emacs 1 417style key bindings are used by default 418(unless the shell was compiled otherwise; see the 419.Va version 420shell variable), 421but 422.Ic bindkey 423can change the key bindings to 424.Xr vi 1 425style bindings en masse. 426.Pp 427The shell always binds the arrow keys (as defined in the 428.Va TERMCAP 429environment variable) to: 430.Pp 431.Bl -tag -width right -compact -offset indent 432.It down 433.Ic down-history 434.It up 435.Ic up-history 436.It left 437.Ic backward-char 438.It right 439.Ic forward-char 440.El 441.Pp 442unless doing so would alter another single-character binding. 443One can set the arrow key escape sequences to the empty string with 444.Va settc 445to prevent these bindings. 446The ANSI/VT100 sequences for arrow keys are always bound. 447.Pp 448Other key bindings are, for the most part, what 449.Xr emacs 1 450and 451.Xr vi 1 452users would expect and can easily be displayed by 453.Ic bindkey , 454so there 455is no need to list them here. 456Likewise, 457.Ic bindkey 458can list the editor 459commands with a short description of each. 460Certain key bindings have different behavior depending if 461.Xr emacs 1 462or 463.Xr vi 1 464style bindings are being used; see 465.Va vimode 466for more information. 467.Pp 468Note that editor commands do not have the same notion of a 469.Dq word 470as does the shell. 471The editor delimits words with any non-alphanumeric characters not in 472the shell variable 473.Va wordchars , 474while the shell recognizes only whitespace 475and some of the characters with special meanings to it, listed under 476.Sx Lexical structure . 477.Ss Completion and listing (+) 478The shell is often able to complete words when given a unique abbreviation. 479Type part of a word (for example 480.Ic ls 481.Pa /usr/lost ) 482and hit the tab key to run the 483.Ic complete-word 484editor command. 485The shell completes the filename 486.Pa /usr/lost 487to 488.Pa /usr/lost+found/ , 489replacing the incomplete word with the complete word in the input buffer. 490(Note the terminal 491.Sq / ; 492completion adds a 493.Sq / 494to the end of completed directories and a space to the end of other completed 495words, to speed typing and provide a visual indicator of successful completion. 496The 497.Va addsuffix 498shell variable can be unset to prevent this.) 499If no match is found (perhaps 500.Pa /usr/lost+found 501doesn't exist), the terminal bell rings. 502If the word is already complete (perhaps there is a 503.Pa /usr/lost 504on your 505system, or perhaps you were thinking too far ahead and typed the whole thing) 506a 507.Sq / 508or space is added to the end if it isn't already there. 509.Pp 510Completion works anywhere in the line, not at just the end; completed 511text pushes the rest of the line to the right. 512Completion in the middle of a word 513often results in leftover characters to the right of the cursor that need 514to be deleted. 515.Pp 516Commands and variables can be completed in much the same way. 517For example, typing 518.Sq em[tab] 519would complete 520.Sq em 521to 522.Sq emacs 523if 524.Pa emacs 525were the only command on your system beginning with 526.Sq em . 527Completion can find a command in any directory in 528.Pa path 529or if given a full pathname. 530Typing 531.Sq echo $ar[tab] 532would complete 533.Sq $ar 534to 535.Sq $argv 536if no other variable began with 537.Sq ar . 538.Pp 539The shell parses the input buffer to determine whether the word you want to 540complete should be completed as a filename, command or variable. 541The first word in the buffer and the first word following 542.Sq \&; , 543.Sq | , 544.Sq |& , 545.Sq && 546or 547.Sq || 548is considered to be a command. 549A word beginning with 550.Sq $ 551is considered to be a variable. 552Anything else is a filename. 553An empty line is 554.Sq completed 555as a filename. 556.Pp 557You can list the possible completions of a word at any time by typing 558.Sq ^D 559to run the 560.Ic delete-char-or-list-or-eof 561editor command. 562The shell lists the possible completions using the 563.Ic ls\-F 564builtin (q.v.) 565and reprints the prompt and unfinished command line, for example: 566.Bd -literal -offset indent 567> ls /usr/l[^D] 568lbin/ lib/ local/ lost+found/ 569> ls /usr/l 570.Ed 571.Pp 572If the 573.Va autolist 574shell variable is set, the shell lists the remaining 575choices (if any) whenever completion fails: 576.Bd -literal -offset indent 577> set autolist 578> nm /usr/lib/libt[tab] 579libtermcap.a@ libtermlib.a@ 580> nm /usr/lib/libterm 581.Ed 582.Pp 583If 584.Va autolist 585shell variable is set to 586.Sq ambiguous , 587choices are listed only when 588completion fails and adds no new characters to the word being completed. 589.Pp 590A filename to be completed can contain variables, your own or others' home 591directories abbreviated with 592.Sq ~ 593(see 594.Sx Filename substitution ) 595and directory stack entries abbreviated with 596.Sq = 597(see 598.Sx Directory stack substitution ) . 599For example, 600.Bd -literal -offset indent 601> ls ~k[^D] 602kahn kas kellogg 603> ls ~ke[tab] 604> ls ~kellogg/ 605.Ed 606or 607.Bd -literal -offset indent 608> set local = /usr/local 609> ls $lo[tab] 610> ls $local/[^D] 611bin/ etc/ lib/ man/ src/ 612> ls $local/ 613.Ed 614.Pp 615Note that variables can also be expanded explicitly with the 616.Ic expand-variables 617editor command. 618.Pp 619.Ic delete-char-or-list-or-eof 620lists at only the end of the line; 621in the middle of a line it deletes the character under the cursor and 622on an empty line it logs one out or, if then 623.Va ignoreeof 624variable is set, does nothing. 625.Sq M-^D , 626bound to the editor command 627.Ic list-choices , 628lists completion 629possibilities anywhere on a line, and 630.Ic list-choices 631(or any one of the 632related editor commands that do or don't delete, list and/or log out, 633listed under 634.Ic delete-char-or-list-or-eof ) 635can be bound to 636.Sq ^D 637with the 638.Ic bindkey 639builtin command if so desired. 640.Pp 641The 642.Ic complete-word-fwd 643and 644.Ic complete-word-back 645editor commands 646(not bound to any keys by default) can be used to cycle up and down through 647the list of possible completions, replacing the current word with the next or 648previous word in the list. 649.Pp 650The shell variable 651.Va fignore 652can be set to a list of suffixes to be ignored by completion. 653Consider the following: 654.Bd -literal -offset indent 655> ls 656Makefile condiments.h~ main.o side.c 657README main.c meal side.o 658condiments.h main.c~ 659> set fignore = (.o \e~) 660> emacs ma[^D] 661main.c main.c~ main.o 662> emacs ma[tab] 663> emacs main.c 664.Ed 665.Pp 666.Sq main.c~ 667and 668.Sq main.o 669are ignored by completion (but not listing), 670because they end in suffixes in 671.Va fignore . 672Note that a 673.Sq \e 674was needed in front of 675.Sq ~ 676to prevent it from being expanded to 677.Va home 678as described under 679.Sx Filename substitution . 680.Va fignore 681is ignored if only one completion is possible. 682.Pp 683If the 684.Va complete 685shell variable is set to 686.Sq enhance , 687completion 1) ignores case and 2) considers periods, hyphens and underscores 688.Sq ( \&. , 689.Sq \&- 690and 691.Sq _ ) 692to be word separators and hyphens and underscores to be equivalent. 693If you had the following files 694.Bd -literal -offset indent 695comp.lang.c comp.lang.perl comp.std.c++ 696comp.lang.c++ comp.std.c 697.Ed 698.Pp 699and typed 700.Sq mail \-f c.l.c[tab] , 701it would be completed to 702.Sq mail \-f comp.lang.c , 703and 704.Sq ^D 705would list 706.Sq comp.lang.c 707and 708.Sq comp.lang.c++ . 709.Sq mail \-f c..c++[^D] 710would list 711.Sq comp.lang.c++ 712and 713.Sq comp.std.c++ . 714Typing 715.Sq rm a\-\-file[^D] 716in the following directory 717.Bd -literal -offset indent 718A_silly_file a-hyphenated-file another_silly_file 719.Ed 720.Pp 721would list all three files, because case is ignored and hyphens and 722underscores are equivalent. 723Periods, however, are not equivalent to 724hyphens or underscores. 725.Pp 726If the 727.Va complete 728shell variable is set to 729.Sq Enhance , 730completion 731ignores case and differences between a hyphen and an underscore word 732separator only when the user types a lowercase character or a hyphen. 733Entering an uppercase character or an underscore will not match the 734corresponding lowercase character or hyphen word separator. 735Typing 736.Sq rm a\-\-file[^D] 737in the directory of the previous example would 738still list all three files, but typing 739.Sq rm A\-\-file 740would match only 741.Sq A_silly_file 742and typing 743.Sq rm a__file[^D] 744would match just 745.Sq A_silly_file 746and 747.Sq another_silly_file 748because the user explicitly used an uppercase 749or an underscore character. 750.Pp 751Completion and listing are affected by several other shell variables: 752.Va recexact 753can be set to complete on the shortest possible unique 754match, even if more typing might result in a longer match: 755.Bd -literal -offset indent 756> ls 757fodder foo food foonly 758> set recexact 759> rm fo[tab] 760.Ed 761.Pp 762just beeps, because 763.Sq fo 764could expand to 765.Sq fod 766or 767.Sq foo , 768but if we type another 769.Sq o , 770.Bd -literal -offset indent 771> rm foo[tab] 772> rm foo 773.Ed 774.Pp 775the completion completes on 776.Sq foo , 777even though 778.Sq food 779and 780.Sq foonly 781also match. 782.Va autoexpand 783can be set to run the 784.Ic expand-history 785editor command 786before each completion attempt, 787.Va autocorrect 788can be set to 789spelling-correct the word to be completed (see 790.Sx Spelling correction ) 791before each completion attempt and 792.Va correct 793can be set to complete commands automatically after one hits 794.Sq return . 795.Va matchbeep 796can be set to make completion beep or not beep in a variety 797of situations, and 798.Va nobeep 799can be set to never beep at all. 800.Va nostat 801can be set to a list of directories and/or patterns that 802match directories to prevent the completion mechanism from 803.Xr stat 2 804ing 805those directories. 806.Va listmax 807and 808.Va listmaxrows 809can be set to limit the number of items 810and rows (respectively) that are listed without asking first. 811.Va recognize_only_executables 812can be set to make the shell list only 813executables when listing commands, but it is quite slow. 814.Pp 815Finally, the 816.Ic complete 817builtin command can be used to tell the shell how 818to complete words other than filenames, commands and variables. 819Completion and listing do not work on glob-patterns (see 820.Sx Filename substitution ) , 821but the 822.Ic list-glob 823and 824.Ic expand-glob 825editor commands perform 826equivalent functions for glob-patterns. 827.Ss Spelling correction (+) 828The shell can sometimes correct the spelling of filenames, commands and 829variable names as well as completing and listing them. 830.Pp 831Individual words can be spelling-corrected with the 832.Ic spell-word 833editor command (usually bound to M-s and M-S) 834and the entire input buffer with 835.Ic spell-line 836(usually bound to M-$). 837The 838.Va correct 839shell variable can be set to 840.Dv cmd 841to correct the command name or 842.Dv all 843to correct the entire line each time return is typed, and 844.Va autocorrect 845can be set to correct the word to be completed 846before each completion attempt. 847.Pp 848When spelling correction is invoked in any of these ways and 849the shell thinks that any part of the command line is misspelled, 850it prompts with the corrected line: 851.Bd -literal -offset indent 852> set correct = cmd 853> lz /usr/bin 854CORRECT>ls /usr/bin (y|n|e|a)? 855.Ed 856.Pp 857One can answer 858.Sq y 859or space to execute the corrected line, 860.Sq e 861to leave the uncorrected command in the input buffer, 862.Sq a 863to abort the command as if 864.Sq ^C 865had been hit, and 866anything else to execute the original line unchanged. 867.Pp 868Spelling correction recognizes user-defined completions (see the 869.Ic complete 870builtin command). 871If an input word in a position for 872which a completion is defined resembles a word in the completion list, 873spelling correction registers a misspelling and suggests the latter 874word as a correction. 875However, if the input word does not match any of 876the possible completions for that position, spelling correction does 877not register a misspelling. 878.Pp 879Like completion, spelling correction works anywhere in the line, 880pushing the rest of the line to the right and possibly leaving 881extra characters to the right of the cursor. 882.Ss Editor commands (+) 883.Ic bindkey 884lists key bindings and 885.Ic bindkey \-l 886lists and briefly describes editor commands. 887Only new or especially interesting editor commands are described here. 888See 889.Xr emacs 1 890and 891.Xr vi 1 892for descriptions of each editor's key bindings. 893.Pp 894The character or characters to which each command is bound by default is 895given in parentheses. 896.Sq ^character 897means a control character and 898.Sq M-character 899a meta character, typed as 900.Sq escape-character 901on terminals without a meta key. 902Case counts, but commands that are bound 903to letters by default are bound to both lower- and uppercase letters for 904convenience. 905.Bl -tag -width indent 906.It Ic backward-char Ar (^B, left) 907Move back a character. 908Cursor behavior modified by 909.Va vimode 910.It Ic backward-delete-word Ar (M-^H, M-^?) 911Cut from beginning of current word to cursor \- saved in cut buffer. 912Word boundary behavior modified by 913.Va vimode 914.It Ic backward-word Ar (M-b, M-B) 915Move to beginning of current word. 916Word boundary and cursor behavior modified by 917.Va vimode 918.It Ic beginning-of-line Ar (^A, home) 919Move to beginning of line. 920Cursor behavior modified by 921.Va vimode 922.It Ic capitalize-word Ar (M-c, M-C) 923Capitalize the characters from cursor to end of current word. 924Word boundary behavior modified by 925.Va vimode 926.It Ic complete-word Ar (tab) 927Completes a word as described under 928.Sx Completion and listing 929.It Ic complete-word-back Ar (not bound) 930Like 931.Ic complete-word-fwd , 932but steps up from the end of the list. 933.It Ic complete-word-fwd Ar (not bound) 934Replaces the current word with the first word in the list of possible 935completions. 936May be repeated to step down through the list. 937At the end of the list, beeps and reverts to the incomplete word. 938.It Ic complete-word-raw Ar (^X-tab) 939Like 940.Ic complete-word , 941but ignores user-defined completions. 942.It Ic copy-prev-word Ar (M-^_) 943Copies the previous word in the current line into the input buffer. 944See also 945.Ic insert-last-word 946Word boundary behavior modified by 947.Va vimode 948.It Ic dabbrev-expand Ar (M-/) 949Expands the current word to the most recent preceding one for which 950the current is a leading substring, wrapping around the history list 951(once) if necessary. 952Repeating 953.Ic dabbrev-expand 954without any intervening typing 955changes to the next previous word etc., skipping identical matches 956much like 957.Ic history-search-backward 958does. 959.It Ic delete-char Ar (not bound) 960Deletes the character under the cursor. 961See also 962.Ic delete-char-or-list-or-eof 963Cursor behavior modified by 964.Va vimode 965.It Ic delete-char-or-eof Ar (not bound) 966Does 967.Ic delete-char 968if there is a character under the cursor or 969.Ic end-of-file 970on an empty line. 971See also 972.Ic delete-char-or-list-or-eof 973Cursor behavior modified by 974.Va vimode 975.It Ic delete-char-or-list Ar (not bound) 976Does 977.Ic delete-char 978if there is a character under the cursor 979or 980.Ic list-choices 981at the end of the line. 982See also 983.Ic delete-char-or-list-or-eof 984.It Ic delete-char-or-list-or-eof Ar (^D) 985Does 986.Ic delete-char 987if there is a character under the cursor, 988.Ic list-choices 989at the end of the line or 990.Ic end-of-file 991on an empty line. 992See also those three commands, each of which does only a single action, and 993.Ic delete-char-or-eof , 994.Ic delete-char-or-list 995and 996.Ic list-or-eof , 997each of which does a different two out of the three. 998.It Ic delete-word Ar (M-d, M-D) 999Cut from cursor to end of current word \- save in cut buffer. 1000Word boundary behavior modified by 1001.Va vimode 1002.It Ic down-history Ar (down-arrow, ^N) 1003Like 1004.Ic up-history , 1005but steps down, stopping at the original input line. 1006.It Ic downcase-word Ar (M-l, M-L) 1007Lowercase the characters from cursor to end of current word. 1008Word boundary behavior modified by 1009.Va vimode 1010.It Ic end-of-file Ar (not bound) 1011Signals an end of file, causing the shell to exit unless the 1012.Va ignoreeof 1013shell variable (q.v.) is set to prevent this. 1014See also 1015.Ic delete-char-or-list-or-eof 1016.It Ic end-of-line Ar (^E, end) 1017Move cursor to end of line. 1018Cursor behavior modified by 1019.Va vimode 1020.It Ic expand-history Ar (M-space) 1021Expands history substitutions in the current word. 1022See 1023.Sx History substitution 1024See also 1025.Ic magic-space , 1026.Ic toggle-literal-history 1027and the 1028.Va autoexpand 1029shell variable. 1030.It Ic expand-glob Ar (^X-*) 1031Expands the glob-pattern to the left of the cursor. 1032See 1033.Sx Filename substitution 1034.It Ic expand-line Ar (not bound) 1035Like 1036.Ic expand-history , 1037but expands history substitutions in each word in the input buffer. 1038.It Ic expand-variables Ar (^X-$) 1039Expands the variable to the left of the cursor. 1040See 1041.Sx Variable substitution 1042.It Ic forward-char Ar (^F, right) 1043Move forward one character. 1044Cursor behavior modified by 1045.Va vimode 1046.It Ic forward-word Ar (M-f, M-F) 1047Move forward to end of current word. 1048Word boundary and cursor behavior modified by 1049.Va vimode 1050.It Ic history-search-backward Ar (M-p, M-P) 1051Searches backwards through the history list for a command beginning with 1052the current contents of the input buffer up to the cursor and copies it 1053into the input buffer. 1054The search string may be a glob-pattern (see 1055.Sx Filename substitution ) 1056containing 1057.Sq * , 1058.Sq \&? , 1059.Sq [] 1060or 1061.Sq {} 1062.Ic up-history 1063and 1064.Ic down-history 1065will proceed from the 1066appropriate point in the history list. 1067Emacs mode only. 1068See also 1069.Ic history-search-forward 1070and 1071.Ic i-search-back 1072.It Ic history-search-forward Ar (M-n, M-N) 1073Like 1074.Ic history-search-backward , 1075but searches forward. 1076.It Ic i-search-back Ar (not bound) 1077Searches backward like 1078.Ic history-search-backward , 1079copies the first match 1080into the input buffer with the cursor positioned at the end of the pattern, 1081and prompts with 1082.Sq bck: 1083and the first match. 1084Additional characters may be 1085typed to extend the search, 1086.Ic i-search-back 1087may be typed to continue 1088searching with the same pattern, wrapping around the history list if 1089necessary, 1090.Ic ( i-search-back 1091must be bound to a 1092single character for this to work) or one of the following special characters 1093may be typed: 1094.Pp 1095.Bl -tag -width indent -compact 1096.It ^W 1097Appends the rest of the word under the cursor to the search pattern. 1098.It delete 1099(or any character bound to 1100.Ic backward-delete-char ) 1101Undoes the effect of the last character typed and deletes a character 1102from the search pattern if appropriate. 1103.It ^G 1104If the previous search was successful, aborts the entire search. 1105If not, goes back to the last successful search. 1106.It escape 1107Ends the search, leaving the current line in the input buffer. 1108.El 1109.Pp 1110Any other character not bound to 1111.Ic self-insert-command 1112terminates the 1113search, leaving the current line in the input buffer, and 1114is then interpreted as normal input. 1115In particular, a carriage return 1116causes the current line to be executed. 1117See also 1118.Ic i-search-fwd 1119and 1120.Ic history-search-backward 1121Word boundary behavior modified by 1122.Va vimode 1123.It Ic i-search-fwd Ar (not bound) 1124Like 1125.Ic i-search-back , 1126but searches forward. 1127Word boundary behavior modified by 1128.Va vimode 1129.It Ic insert-last-word Ar (M-_) 1130Inserts the last word of the previous input line 1131.Sq ( \&!$ ) 1132into the input buffer. 1133See also 1134.Ic copy-prev-word 1135.It Ic list-choices Ar (M-^D) 1136Lists completion possibilities as described under 1137.Sx Completion and listing 1138See also 1139.Ic delete-char-or-list-or-eof 1140and 1141.Ic list-choices-raw 1142.It Ic list-choices-raw Ar (^X-^D) 1143Like 1144.Ic list-choices , 1145but ignores user-defined completions. 1146.It Ic list-glob Ar (^X-g, ^X-G) 1147Lists (via the 1148.Ic ls\-F 1149builtin) matches to the glob-pattern 1150(see 1151.Sx Filename substitution ) 1152to the left of the cursor. 1153.It Ic list-or-eof Ar (not bound) 1154Does 1155.Ic list-choices 1156or 1157.Ic end-of-file 1158on an empty line. 1159See also 1160.Ic delete-char-or-list-or-eof 1161.It Ic magic-space Ar (not bound) 1162Expands history substitutions in the current line, 1163like 1164.Ic expand-history , 1165and inserts a space. 1166.Ic magic-space 1167is designed to be bound to the space bar, 1168but is not bound by default. 1169.It Ic normalize-command Ar (^X-?) 1170Searches for the current word in PATH and, if it is found, replaces it with 1171the full path to the executable. 1172Special characters are quoted. 1173Aliases are 1174expanded and quoted but commands within aliases are not. 1175This command is 1176useful with commands that take commands as arguments, e.g., 1177.Sq dbx 1178and 1179.Sq sh \-x 1180.It Ic normalize-path Ar (^X-n, ^X-N) 1181Expands the current word as described under the 1182.Sq expand 1183setting 1184of the 1185.Va symlinks 1186shell variable. 1187.It Ic overwrite-mode Ar (unbound) 1188Toggles between input and overwrite modes. 1189.It Ic run-fg-editor Ar (M-^Z) 1190Saves the current input line and 1191looks for a stopped job where the file name portion of its first word 1192is found in the 1193.Va editors 1194shell variable. 1195If 1196.Va editors 1197is not set, then the file name portion of the 1198.Va EDITOR 1199environment variable 1200.Sq ( ed 1201if unset) 1202and the 1203.Va VISUAL 1204environment variable 1205Sq ( vi 1206if unset) 1207will be used. 1208If such a job is found, it is restarted as if 1209.Sq fg % 1210.Ic job 1211had been typed. 1212This is used to toggle back and forth between an editor and 1213the shell easily. 1214Some people bind this command to 1215.Sq ^Z 1216so they 1217can do this even more easily. 1218.It Ic run-help Ar (M-h, M-H) 1219Searches for documentation on the current command, using the same notion of 1220.Sq current command 1221as the completion routines, and prints it. 1222There is no way 1223to use a pager; 1224.Ic run-help 1225is designed for short help files. 1226If the special alias 1227.Va helpcommand 1228is defined, it is run with the 1229command name as a sole argument. 1230Else, 1231documentation should be in a file named 1232.Sq command.help , 1233.Sq command.1 , 1234.Sq command.6 , 1235.Sq command.8 , 1236or 1237.Sq command , 1238which should be in one 1239of the directories listed in the 1240.Va HPATH 1241environment variable. 1242If there is more than one help file only the first is printed. 1243.It Ic self-insert-command Ar (text characters) 1244In insert mode (the default), inserts the typed character into the input line after the character under the cursor. 1245In overwrite mode, replaces the character under the cursor with the typed character. 1246The input mode is normally preserved between lines, but the 1247.Va inputmode 1248shell variable can be set to 1249.Dv insert 1250or 1251.Dv overwrite 1252to put the 1253editor in that mode at the beginning of each line. 1254See also 1255.Ic overwrite-mode 1256.It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X) 1257Indicates that the following characters are part of a 1258multi-key sequence. 1259Binding a command to a multi-key sequence really creates 1260two bindings: the first character to 1261.Ic sequence-lead-in 1262and the 1263whole sequence to the command. 1264All sequences beginning with a character 1265bound to 1266.Ic sequence-lead-in 1267are effectively bound to 1268.Ic undefined-key 1269unless bound to another command. 1270.It Ic spell-line Ar (M-$) 1271Attempts to correct the spelling of each word in the input buffer, like 1272.Ic spell-word , 1273but ignores words whose first character is one of 1274.Sq \- , 1275.Sq \ ! , 1276.Sq ^ 1277or 1278.Sq % , 1279or which contain 1280.Sq \e , 1281.Sq * 1282or 1283.Sq \&? , 1284to avoid problems with switches, substitutions and the like. 1285See 1286.Sx Spelling correction 1287.It Ic spell-word Ar (M-s, M-S) 1288Attempts to correct the spelling of the current word as described under 1289.Sx Spelling correction 1290Checks each component of a word which appears to be a pathname. 1291.It Ic toggle-literal-history Ar (M-r, M-R) 1292Expands or 1293.Sq unexpands 1294history substitutions in the input buffer. 1295See also 1296.Ic expand-history 1297and the 1298.Va autoexpand 1299shell variable. 1300.It Ic undefined-key Ar (any unbound key) 1301Beeps. 1302.It Ic up-history Ar (up-arrow, ^P) 1303Copies the previous entry in the history list into the input buffer. 1304If 1305.Va histlit 1306is set, uses the literal form of the entry. 1307May be repeated to step up through the history list, stopping at the top. 1308.It Ic upcase-word Ar (M-u, M-U) 1309Uppercase the characters from cursor to end of current word. 1310Word boundary behavior modified by 1311.Va vimode 1312.It Ic vi-beginning-of-next-word Ar (not bound) 1313Vi goto the beginning of next word. 1314Word boundary and cursor behavior modified by 1315.Va vimode 1316.It Ic vi-eword Ar (not bound) 1317Vi move to the end of the current word. 1318Word boundary behavior modified by 1319.Va vimode 1320.It Ic vi-search-back Ar (?) 1321Prompts with 1322.Sq \&? 1323for a search string (which may be a glob-pattern, as with 1324.Ic history-search-backward ), 1325searches for it and copies it into the input buffer. 1326The bell rings if no match is found. 1327Hitting return ends the search and leaves the last match in the input 1328buffer. 1329Hitting escape ends the search and executes the match. 1330.Ic vi 1331mode only. 1332.It Ic vi-search-fwd Ar (/) 1333Like 1334.Ic vi-search-back , 1335but searches forward. 1336.It Ic which-command Ar (M-?) 1337Does a 1338.Ic which 1339(see the description of the builtin command) on the 1340first word of the input buffer. 1341.It Ic yank-pop Ar (M-y) 1342When executed immediately after a 1343.Ic yank 1344or another 1345.Ic yank-pop , 1346replaces the yanked string with the next previous string from the 1347killring. This also has the effect of rotating the killring, such that 1348this string will be considered the most recently killed by a later 1349.Ic yank 1350command. Repeating 1351.Ic yank-pop 1352will cycle through the 1353killring any number of times. 1354.El 1355.Ss Lexical structure 1356The shell splits input lines into words at blanks and tabs. 1357The special 1358characters 1359.Sq \&& , 1360.Sq | , 1361.Sq \&; , 1362.Sq < , 1363.Sq > , 1364.Sq \&( , 1365and 1366.Sq \&) 1367and the doubled characters 1368.Sq && , 1369.Sq || , 1370.Sq << 1371and 1372.Sq >> 1373are always separate words, whether or not they are 1374surrounded by whitespace. 1375.Pp 1376When the shell's input is not a terminal, the character 1377.Sq # 1378is taken to begin a 1379comment. 1380Each 1381.Sq # 1382and the rest of the input line on which it appears is 1383discarded before further parsing. 1384.Pp 1385A special character (including a blank or tab) may be prevented from having 1386its special meaning, and possibly made part of another word, by preceding it 1387with a backslash 1388.Sq ( \e ) 1389or enclosing it in single 1390.Sq ( \&' ) , 1391, double 1392.Sq ( \&" ) 1393or 1394backward 1395.Sq ( \&` ) 1396quotes. 1397When not otherwise quoted a newline preceded by a 1398.Sq \e 1399is equivalent to a blank, but inside quotes this sequence results in a 1400newline. 1401.Pp 1402Furthermore, all 1403.Sx Substitutions 1404(see below) except 1405.Sx History substitution 1406can be prevented by enclosing the strings (or parts of strings) 1407in which they appear with single quotes or by quoting the crucial character(s) 1408(e.g., 1409.Sq $ 1410or 1411.Sq \&` 1412for 1413.Sx Variable substitution 1414or 1415.Sx Command substitution 1416respectively) 1417with 1418.Sq \e 1419.Sx ( Alias substitution 1420is no exception: quoting in any way any 1421character of a word for which an 1422.Va alias 1423has been defined prevents 1424substitution of the alias. 1425The usual way of quoting an alias is to precede it 1426with a backslash.) 1427.Sx History substitution 1428is prevented by 1429backslashes but not by single quotes. 1430Strings quoted with double or backward 1431quotes undergo 1432.Sx Variable substitution 1433and 1434.Sx Command substitution , 1435but other substitutions are prevented. 1436.Pp 1437Text inside single or double quotes becomes a single word (or part of one). 1438Metacharacters in these strings, including blanks and tabs, do not form 1439separate words. 1440Only in one special case (see 1441.Sx Command substitution 1442below) can a double-quoted string yield parts of more than one word; 1443single-quoted strings never do. 1444Backward quotes are special: they signal 1445.Sx Command substitution 1446(q.v.), which may result in more than one word. 1447.Pp 1448Quoting complex strings, particularly strings which themselves contain quoting 1449characters, can be confusing. 1450Remember that quotes need not be used as they are 1451in human writing! 1452It may be easier to quote not an entire string, but only 1453those parts of the string which need quoting, using different types of quoting 1454to do so if appropriate. 1455.Pp 1456The 1457.Va backslash_quote 1458shell variable (q.v.) can be set to make backslashes 1459always quote 1460.Sq \e , 1461.Sq \&' , 1462and 1463.Sq \&" 1464(+) This may make complex quoting tasks 1465easier, but it can cause syntax errors in 1466.Xr csh 1 1467scripts. 1468.Ss Substitutions 1469We now describe the various transformations the shell performs on the input in 1470the order in which they occur. 1471We note in passing the data structures involved 1472and the commands and variables which affect them. 1473Remember that substitutions 1474can be prevented by quoting as described under 1475.Sx Lexical structure . 1476.Ss History substitution 1477Each command, or 1478.Sq event , 1479input from the terminal is saved in the history list. 1480The previous command is always saved, and the 1481.Va history 1482shell 1483variable can be set to a number to save that many commands. 1484The 1485.Va histdup 1486shell variable can be set to not save duplicate events or consecutive duplicate 1487events. 1488.Pp 1489Saved commands are numbered sequentially from 1 and stamped with the time. 1490It is not usually necessary to use event numbers, but the current event number 1491can be made part of the prompt by placing an 1492.Sq \&! 1493in the 1494.Va prompt 1495shell variable. 1496.Pp 1497The shell actually saves history in expanded and literal (unexpanded) forms. 1498If the 1499.Va histlit 1500shell variable is set, commands that display and store 1501history use the literal form. 1502.Pp 1503The 1504.Va history 1505builtin command can print, store in a file, restore 1506and clear the history list at any time, 1507and the 1508.Va savehist 1509and 1510.Va histfile 1511shell variables can be set to 1512store the history list automatically on logout and restore it on login. 1513.Pp 1514History substitutions introduce words from the history list into the input 1515stream, making it easy to repeat commands, repeat arguments of a previous 1516command in the current command, or fix spelling mistakes in the previous 1517command with little typing and a high degree of confidence. 1518.Pp 1519History substitutions begin with the character 1520.Sq \&! 1521They may begin anywhere in 1522the input stream, but they do not nest. 1523The 1524.Sq \&! 1525may be preceded by a 1526.Sq \e 1527to 1528prevent its special meaning; for convenience, a 1529.Sq \&! 1530is passed unchanged when it 1531is followed by a blank, tab, newline, 1532.Sq = 1533or 1534.Sq \&( 1535History substitutions also 1536occur when an input line begins with 1537.Sq ^ 1538This special abbreviation will be 1539described later. 1540The characters used to signal history substitution 1541.Sq ( \&! 1542and 1543.Sq ^ ) 1544can be changed by setting the 1545.Va histchars 1546shell variable. 1547Any input 1548line which contains a history substitution is printed before it is executed. 1549.Pp 1550A history substitution may have an 1551.Sq event specification , 1552which indicates the event from which words are to be taken, a 1553.Sq word designator , 1554which selects particular words from the chosen event, and/or a 1555.Sq modifier , 1556which manipulates the selected words. 1557.Pp 1558An event specification can be 1559.Pp 1560.Bl -tag -width XXXX -offset indent -compact 1561.It Ar n 1562A number, referring to a particular event 1563.It Ar \-n 1564An offset, referring to the event 1565.Ar n 1566before the current event 1567.It Ar # 1568The current event. 1569This should be used carefully in 1570.Xr csh 1 , 1571where there is no check for recursion. 1572.Nm 1573allows 10 levels of recursion. 1574(+) 1575.It Ar \&! 1576The previous event (equivalent to 1577.Sq \-1 ) 1578.It Ar s 1579The most recent event whose first word begins with the string 1580.Va s 1581.It Ar ?s? 1582The most recent event which contains the string 1583.Va s 1584The second 1585.Sq \&? 1586can be omitted if it is immediately followed by a newline. 1587.El 1588.Pp 1589For example, consider this bit of someone's history list: 1590.Bd -literal -offset indent 1591 9 8:30 nroff \-man wumpus.man 159210 8:31 cp wumpus.man wumpus.man.old 159311 8:36 vi wumpus.man 159412 8:37 diff wumpus.man.old wumpus.man 1595.Ed 1596.Pp 1597The commands are shown with their event numbers and time stamps. 1598The current event, which we haven't typed in yet, is event 13. 1599.Sq !11 1600and 1601.Sq !\-2 1602refer to event 11. 1603.Sq \&!! 1604refers to the previous event, 12. 1605.Sq \&!! 1606can be abbreviated 1607.Sq \&! 1608if it is 1609followed by 1610.Sq \&: 1611.Sq ( \&: 1612is described below). 1613.Sq !n 1614refers to event 9, which begins with 1615.Sq n 1616.Sq !?old? 1617also refers to event 12, which contains 1618.Sq old 1619Without word designators or modifiers history references simply expand to the 1620entire event, so we might type 1621.Sq !cp 1622to redo the copy command or 1623.Sq !!|more 1624if the 1625.Sq diff 1626output scrolled off the top of the screen. 1627.Pp 1628History references may be insulated from the surrounding text with braces if 1629necessary. 1630For example, 1631.Sq !vdoc 1632would look for a command beginning with 1633.Sq vdoc , 1634and, in this example, not find one, but 1635.Sq !{v}doc 1636would expand 1637unambiguously to 1638.Sq vi wumpus.mandoc 1639Even in braces, history substitutions do not nest. 1640.Pp 1641(+) While 1642.Xr csh 1 1643expands, for example, 1644.Sq !3d 1645to event 3 with the 1646letter 1647.Sq d 1648appended to it, 1649.Nm 1650expands it to the last event beginning 1651with 1652.Sq 3d ; 1653only completely numeric arguments are treated as event numbers. 1654This makes it possible to recall events beginning with numbers. 1655To expand 1656.Sq !3d 1657as in 1658.Xr csh 1 1659say 1660.Sq !{3}d 1661.Pp 1662To select words from an event we can follow the event specification by a 1663.Sq \&: 1664and a designator for the desired words. 1665The words of an input line are 1666numbered from 0, the first (usually command) word being 0, the second word 1667(first argument) being 1, etc. 1668The basic word designators are: 1669.Pp 1670.Bl -tag -width XXXX -offset indent -compact 1671.It Ar 0 1672The first (command) word 1673.It Ar n 1674The 1675.Va n 1676th argument 1677.It Ar ^ 1678The first argument, equivalent to 1679.Sq 1 1680.It Ar $ 1681The last argument 1682.It Ar % 1683The word matched by an ? 1684.Va s 1685? search 1686.It Ar x\-y 1687A range of words 1688.It Ar \-y 1689Equivalent to 1690.Sq 0\-y 1691.It Ar * 1692Equivalent to 1693.Sq ^\-$ , 1694but returns nothing if the event contains only 1 word 1695.It Ar x* 1696Equivalent to 1697.Sq x\-$ 1698.It Ar x\- 1699Equivalent to 1700.Sq x* , 1701but omitting the last word 1702.Sq ( $ ) 1703.El 1704.Pp 1705Selected words are inserted into the command line separated by single blanks. 1706For example, the 1707.Sq diff 1708command in the previous example might have been 1709typed as 1710.Sq diff !!:1.old !!:1 1711(using 1712.Sq \&:1 1713to select the first argument 1714from the previous event) or 1715.Sq diff !\-2:2 !\-2:1 1716to select and swap the 1717arguments from the 1718.Sq cp 1719command. 1720If we didn't care about the order of the 1721`diff' we might have said 1722.Sq diff !\-2:1\-2 1723or simply 1724.Sq diff !\-2:* 1725The 1726.Sq cp 1727command might have been written 1728.Sq cp wumpus.man !#:1.old 1729, using 1730.Sq # 1731to refer to the current event. 1732`!n:\- hurkle.man' would reuse the first two words from the 1733.Sq nroff 1734command 1735to say 1736.Sq nroff \-man hurkle.man 1737.Pp 1738The 1739.Sq \&: 1740separating the event specification from the word designator can be 1741omitted if the argument selector begins with a 1742.Sq ^ , 1743.Sq $ , 1744.Sq * , 1745.Sq % 1746or 1747.Sq \&- 1748For example, our 1749.Sq diff 1750command might have been 1751.Sq diff !!^.old !!^ 1752or, 1753equivalently, 1754.Sq diff !!$.old !!$ 1755However, if 1756.Sq \&!! 1757is abbreviated 1758.Sq \&! 1759, 1760an argument selector beginning with 1761.Sq \- 1762will be interpreted as an event 1763specification. 1764.Pp 1765A history reference may have a word designator but no event specification. 1766It then references the previous command. 1767Continuing our 1768.Sq diff 1769example, we could have said simply `diff 1770!^.old !^' or, to get the arguments in the opposite order, just 1771.Sq diff !* 1772.Pp 1773The word or words in a history reference can be edited, or 1774.Sq `modified 1775', 1776by following it with one or more modifiers, each preceded by a 1777.Sq \&: : 1778.Pp 1779.Bl -tag -width XXXXXX -offset indent -compact 1780.It Ar h 1781Remove a trailing pathname component, leaving the head. 1782.It Ar t 1783Remove all leading pathname components, leaving the tail. 1784.It Ar r 1785Remove a filename extension 1786.Sq .xxx , 1787leaving the root name. 1788.It Ar e 1789Remove all but the extension. 1790.It Ar u 1791Uppercase the first lowercase letter. 1792.It Ar l 1793Lowercase the first uppercase letter. 1794.It Ar s/l/r/ 1795Substitute 1796.Ar l 1797for 1798.Ar r 1799.Ar l 1800is simply a string like 1801.Ar r 1802, not a regular expression as in 1803the eponymous 1804.Xr ed 1 1805command. 1806Any character may be used as the delimiter in place of 1807.Sq / ; 1808a 1809.Sq \e 1810can be used to quote the delimiter inside 1811.Va l 1812and 1813.Va r 1814The character 1815.Sq & 1816in the 1817.Va r 1818is replaced by 1819.Va l ; 1820.Sq \e 1821also quotes 1822.Sq & 1823If 1824.Va l 1825is empty ( 1826.Dq \& ) , 1827the 1828.Va l 1829from a previous substitution or the 1830.Va s 1831from a previous search or event number in event specification is used. 1832The trailing delimiter may be omitted if it is immediately followed by a 1833newline. 1834.It Ar \&& 1835Repeat the previous substitution. 1836.It Ar g 1837Apply the following modifier once to each word. 1838.It Ar a (+) 1839Apply the following modifier as many times as possible to a single word. 1840.Sq a 1841and 1842.Sq g 1843can be used together to apply a modifier globally. 1844With the 1845.Sq s 1846modifier, only the patterns contained in the original word are 1847substituted, not patterns that contain any substitution result. 1848.It Ar p 1849Print the new command line but do not execute it. 1850.It Ar q 1851Quote the substituted words, preventing further substitutions. 1852.It Ar x 1853Like 1854.Ar q , 1855but break into words at blanks, tabs and newlines. 1856.El 1857.Pp 1858Modifiers are applied to only the first modifiable word (unless 1859.Sq g 1860is used). 1861It is an error for no word to be modifiable. 1862.Pp 1863For example, the 1864.Sq diff 1865command might have been written as `diff wumpus.man.old 1866!#^:r', using 1867.Sq \&:r 1868to remove 1869.Sq .old 1870from the first argument on the same line 1871(`!#^'). 1872We could say 1873.Sq echo hello out there 1874, then 1875.Sq echo !*:u 1876to capitalize 1877`hello', 1878.Sq echo !*:au 1879to say it out loud, or 1880.Sq echo !*:agu 1881to really shout. 1882We might follow 1883.Sq mail \-s "I forgot my password" rot 1884with 1885.Sq !:s/rot/root 1886to 1887correct the spelling of 1888.Sq root 1889(but see 1890.Sx Spelling correction 1891for a 1892different approach). 1893.Pp 1894There is a special abbreviation for substitutions. 1895.Sq ^ , 1896when it is the first character on an input line, is equivalent to 1897.Sq !:s^ 1898Thus we might have said 1899.Sq ^rot^root 1900to make the spelling correction in the 1901previous example. 1902This is the only history substitution which does not explicitly begin with 1903.Sq \&! 1904.Pp 1905(+) In 1906.Xr csh 1 1907as such, only one modifier may be applied to each history 1908or variable expansion. 1909In 1910.Nm , 1911more than one may be used, for example 1912.Bd -literal -offset indent 1913% mv wumpus.man /usr/man/man1/wumpus.1 1914% man !$:t:r 1915man wumpus 1916.Ed 1917.Pp 1918In 1919.Xr csh 1 , 1920the result would be 1921.Sq wumpus.1:r 1922A substitution followed by a 1923colon may need to be insulated from it with braces: 1924.Bd -literal -offset indent 1925> mv a.out /usr/games/wumpus 1926> setenv PATH !$:h:$PATH 1927Bad ! modifier: $. 1928> setenv PATH !{\-2$:h}:$PATH 1929setenv PATH /usr/games:/bin:/usr/bin:. 1930.Ed 1931.Pp 1932The first attempt would succeed in 1933.Xr csh 1 1934but fails in 1935.Nm , 1936because 1937.Nm 1938expects another modifier after the second colon 1939rather than 1940.Sq $ 1941.Pp 1942Finally, history can be accessed through the editor as well as through 1943the substitutions just described. 1944The 1945.Ic up- 1946and 1947.Ic down-history , 1948.Ic history-search-backward 1949and 1950.Va -forward , 1951.Ic i-search-back 1952and 1953.Ic -fwd , 1954.Ic vi-search-back 1955and 1956.Ic -fwd , 1957.Ic copy-prev-word 1958and 1959.Ic insert-last-word 1960editor commands search for 1961events in the history list and copy them into the input buffer. 1962The 1963.Ic toggle-literal-history 1964editor command switches between the 1965expanded and literal forms of history lines in the input buffer. 1966.Ic expand-history 1967and 1968.Ic expand-line 1969expand history substitutions 1970in the current word and in the entire input buffer respectively. 1971.Ss Alias substitution 1972The shell maintains a list of aliases which can be set, unset and printed by 1973the 1974.Ic alias 1975and 1976.Ic unalias 1977commands. 1978After a command line is parsed 1979into simple commands (see 1980.Sx Commands ) 1981the first word of each command, 1982left-to-right, is checked to see if it has an alias. 1983If so, the first word is 1984replaced by the alias. 1985If the alias contains a history reference, it undergoes 1986.Va History substitution 1987(q.v.) as though the original command were the 1988previous input line. 1989If the alias does not contain a history reference, the 1990argument list is left untouched. 1991.Pp 1992Thus if the alias for 1993.Sq ls 1994were 1995.Sq ls \-l 1996the command 1997.Sq ls /usr 1998would become `ls 1999\-l /usr', the argument list here being undisturbed. 2000If the alias for 2001.Sq lookup 2002were 2003.Sq grep !/etc/passwd 2004then 2005.Sq lookup bill 2006would become `grep bill 2007/etc/passwd'. 2008Aliases can be used to introduce parser metasyntax. 2009For 2010example, 2011.Sq alias print 2012pr \e!* | lpr'' defines a 2013.Sq `command 2014' (`print') which 2015.Va pr 2016(1)s its arguments to the line printer. 2017.Pp 2018Alias substitution is repeated until the first word of the command has no 2019alias. 2020If an alias substitution does not change the first word (as in the 2021previous example) it is flagged to prevent a loop. 2022Other loops are detected and 2023cause an error. 2024.Pp 2025Some aliases are referred to by the shell; see 2026.Va Special aliases 2027.Ss Variable substitution 2028The shell maintains a list of variables, each of which has as value a list of 2029zero or more words. 2030The values of shell variables can be displayed and changed with the 2031.Va set 2032and 2033.Va unset 2034commands. 2035The system maintains its own list of 2036.Sq `environment 2037' variables. 2038These can be displayed and changed with 2039.Va printenv 2040, 2041.Va setenv 2042and 2043.Va unsetenv 2044.Pp 2045(+) Variables may be made read-only with 2046.Sq set \-r 2047(q.v.). 2048Read-only variables may not be modified or unset; 2049attempting to do so will cause an error. 2050Once made read-only, a variable cannot be made writable, 2051so 2052.Sq set \-r 2053should be used with caution. 2054Environment variables cannot be made read-only. 2055.Pp 2056Some variables are set by the shell or referred to by it. 2057For instance, the 2058.Va argv 2059variable is an image of the shell's argument 2060list, and words of this variable's value are referred to in special ways. 2061Some of the variables referred to by the shell are toggles; 2062the shell does not care what their value is, only whether they are set or not. 2063For instance, the 2064.Va verbose 2065variable is a toggle which causes command 2066input to be echoed. 2067The 2068.Fl v\fR command line option sets this variable. 2069.Va Special shell variables 2070lists all variables which are referred to by the shell. 2071.Pp 2072Other operations treat variables numerically. 2073The 2074.Sq @ 2075command permits numeric 2076calculations to be performed and the result assigned to a variable. 2077Variable 2078values are, however, always represented as (zero or more) strings. 2079For the 2080purposes of numeric operations, the null string is considered to be zero, and 2081the second and subsequent words of multi-word values are ignored. 2082.Pp 2083After the input line is aliased and parsed, and before each command is 2084executed, variable substitution is performed keyed by 2085.Sq $ 2086characters. 2087This 2088expansion can be prevented by preceding the 2089.Sq $ 2090with a 2091.Sq \e 2092except within 2093.Sq " 2094s 2095where it 2096.Va always 2097occurs, and within 2098.Sq 2099's where it 2100.Va never 2101occurs. 2102Strings quoted by 2103.Sq \` 2104are interpreted later (see 2105.Sx Command substitution 2106below) so 2107.Sq $ 2108substitution does not occur there until later, 2109if at all. 2110A 2111.Sq $ 2112is passed unchanged if followed by a blank, tab, or 2113end-of-line. 2114.Pp 2115Input/output redirections are recognized before variable expansion, and are 2116variable expanded separately. 2117Otherwise, the command name and entire argument 2118list are expanded together. 2119It is thus possible for the first (command) word 2120(to this point) to generate more than one word, the first of which becomes the 2121command name, and the rest of which become arguments. 2122.Pp 2123Unless enclosed in 2124.Sq " 2125or given the 2126.Sq \&:q 2127modifier the results of variable 2128substitution may eventually be command and filename substituted. 2129Within 2130.Sq " 2131, a 2132variable whose value consists of multiple words expands to a (portion of a) 2133single word, with the words of the variable's value separated by blanks. 2134When 2135the 2136.Sq \&:q 2137modifier is applied to a substitution the variable will expand to 2138multiple words with each word separated by a blank and quoted to prevent later 2139command or filename substitution. 2140.Pp 2141The following metasequences are provided for introducing variable values into 2142the shell input. 2143Except as noted, it is an error to reference a variable which 2144is not set. 2145.Pp 2146.Bl -tag -width XXXXXXXXXX -offset indent -compact 2147.PD 0 2148.It Ar $name 2149.It Ar ${name} 2150Substitutes the words of the value of variable 2151.Va name , 2152each separated 2153by a blank. 2154Braces insulate 2155.Va name 2156from following characters which would 2157otherwise be part of it. 2158Shell variables have names consisting of 2159letters and digits starting with a letter. 2160The underscore character is 2161considered a letter. 2162If 2163.Va name 2164is not a shell variable, but is set in the 2165environment, then that value is returned (but some of the other forms 2166given below are not available in this case). 2167.It Ar $name[selector] 2168.It Ar ${name[selector]} 2169Substitutes only the selected words from the value of 2170.Va name 2171The 2172.Va selector 2173is subjected to 2174.Sq $ 2175substitution and may consist of 2176a single number or two numbers separated by a 2177.Sq \&- 2178The first word of a variable's value is numbered 2179.Sq 1 2180If the first number of a range is omitted it defaults to 2181.Sq 1 2182If the last member of a range is omitted it defaults to 2183.Sq $# 2184.Va name 2185The 2186.Va selector 2187.Sq * 2188selects all words. 2189It is not an error for a range to be empty if the 2190second argument is omitted or in range. 2191.It Ar $0 2192Substitutes the name of the file from which command input 2193is being read. 2194An error occurs if the name is not known. 2195.It Ar $number 2196.It Ar ${number} 2197Equivalent to 2198.Sq $argv[number] 2199.It Ar $* 2200Equivalent to 2201.Sq $argv , 2202which is equivalent to 2203.Sq $argv[*] 2204.El 2205.Pp 2206The 2207.Sq \&: 2208modifiers described under 2209.Sx History substitution , 2210except for 2211.Sq \&:p , 2212can be applied to the substitutions above. 2213More than one may be used. 2214(+) 2215Braces may be needed to insulate a variable substitution from a literal colon 2216just as with 2217.Sx History substitution 2218(q.v.); any modifiers must appear 2219within the braces. 2220.Pp 2221The following substitutions can not be modified with 2222.Sq \&: 2223modifiers. 2224.Pp 2225.Bl -tag -width XXXXXXXXXX -offset indent -compact 2226.It Ar $?name 2227.It Ar ${?name} 2228Substitutes the string 2229.Sq 1 2230if 2231.Va name 2232is set, 2233.Sq 0 2234if it is not. 2235.It Ar $?0 2236Substitutes 2237.Sq 1 2238if the current input filename is known, 2239.Sq 0 2240if it is not. 2241Always 2242.Sq 0 2243in interactive shells. 2244.It Ar $#name 2245.It Ar ${#name} 2246Substitutes the number of words in 2247.Va name 2248.It Ar $# 2249Equivalent to 2250.Sq $#argv 2251(+) 2252.It Ar $%name 2253.It Ar ${%name} 2254Substitutes the number of characters in 2255.Va name 2256(+) 2257.Pp 2258.It Ar $%number 2259.It Ar ${%number} 2260Substitutes the number of characters in 2261.Va $argv[number] . 2262(+) 2263.It Ar $? 2264Equivalent to 2265.Sq $status 2266(+) 2267.It Ar $$ 2268Substitutes the (decimal) process number of the (parent) shell. 2269.It Ar $! 2270Substitutes the (decimal) process number of the last 2271background process started by this shell. 2272(+) 2273.It Ar $_ 2274Substitutes the command line of the last command executed. 2275(+) 2276.It Ar $< 2277Substitutes a line from the standard input, with no further interpretation 2278thereafter. 2279It can be used to read from the keyboard in a shell script. 2280(+) While 2281.Xr csh 1 2282always quotes $<, as if it were equivalent to 2283.Sq $<:q , 2284.Nm 2285does not. 2286Furthermore, when 2287.Nm 2288is waiting for a line to be 2289typed the user may type an interrupt to interrupt the sequence into 2290which the line is to be substituted, but 2291.Xr csh 1 2292does not allow this. 2293.El 2294.Pp 2295The editor command 2296.Va expand-variables 2297, normally bound to 2298.Sq ^X-$ , 2299can be used to interactively expand individual variables. 2300.Ss "Command, filename and directory stack substitution" 2301The remaining substitutions are applied selectively to the arguments 2302of builtin commands. 2303This means that portions of expressions which are not evaluated are 2304not subjected to these expansions. 2305For commands which are not internal to the 2306shell, the command name is substituted separately from the argument list. 2307This occurs very late, after input-output redirection is performed, andk 2308in a child of the main shell. 2309.Ss "Command substitution" 2310Command substitution is indicated by a command enclosed in 2311.Sq \&` 2312The output 2313from such a command is broken into separate words at blanks, tabs and newlines, 2314and null words are discarded. 2315The output is variable and command substituted 2316and put in place of the original string. 2317.Pp 2318Command substitutions inside double 2319quotes 2320.Sq ( \&" ) 2321retain blanks and tabs; only newlines force new words. 2322The single 2323final newline does not force a new word in any case. 2324It is thus possible for a 2325command substitution to yield only part of a word, even if the command outputs 2326a complete line. 2327.Pp 2328By default, the shell since version 6.12 replaces all newline and carriage 2329return characters in the command by spaces. 2330If this is switched off by 2331unsetting 2332.Va csubstnonl , 2333newlines separate commands as usual. 2334.Ss "Filename substitution" 2335If a word contains any of the characters 2336.Sq * , 2337.Sq \&? , 2338.Sq \&[ 2339or 2340.Sq { 2341or begins with 2342the character 2343.Sq ~ 2344it is a candidate for filename substitution, also known as 2345.Dq globbing . 2346This word is then regarded as a pattern 2347.Dq ( glob-pattern ) , 2348and 2349replaced with an alphabetically sorted list of file names which match the 2350pattern. 2351.Pp 2352In matching filenames, the character 2353.Sq . 2354at the beginning of a filename or 2355immediately following a 2356.Sq / , 2357as well as the character 2358.Sq / 2359must be matched 2360explicitly (unless either 2361.Va globdot 2362or 2363.Va globstar 2364or both are set(+)). 2365The character 2366.Sq * 2367matches any string of characters, 2368including the null string. 2369The character 2370.Sq \&? 2371matches any single character. 2372The sequence 2373.Sq [...] 2374matches any one of the characters enclosed. 2375Within 2376.Sq [...] 2377, a pair of 2378characters separated by 2379.Sq \&- 2380matches any character lexically between the two. 2381.Pp 2382(+) Some glob-patterns can be negated: 2383The sequence 2384.Sq [^...] 2385matches any single character 2386.Va not 2387specified by the 2388characters and/or ranges of characters in the braces. 2389.Pp 2390An entire glob-pattern can also be negated with 2391.Sq ^ : 2392.Bd -literal -offset indent 2393> echo * 2394bang crash crunch ouch 2395> echo ^cr* 2396bang ouch 2397.Ed 2398.Pp 2399Glob-patterns which do not use 2400.Sq \&? , 2401.Sq * , or 2402.Sq [] 2403or which use 2404.Sq {} 2405or 2406.Sq ~ 2407(below) are not negated correctly. 2408.Pp 2409The metanotation 2410.Sq a{b,c,d}e 2411is a shorthand for 2412.Sq abe ace ade 2413Left-to-right order is preserved: 2414.Sq /usr/source/s1/{oldls,ls}.c 2415expands 2416to 2417.Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c 2418The results of matches are 2419sorted separately at a low level to preserve this order: 2420.Sq ../{memo,*box} 2421might expand to 2422.Sq ../memo ../box ../mbox 2423(Note that 2424.Sq memo 2425was not sorted with the results of matching 2426.Sq *box . ) 2427It is not an error when this construct expands to files which do not exist, 2428but it is possible to get an error from a command to which the expanded list 2429is passed. 2430This construct may be nested. 2431As a special case the words 2432.Sq { , 2433.Sq } 2434and 2435.Sq {} 2436are passed undisturbed. 2437.Pp 2438The character 2439.Sq ~ 2440at the beginning of a filename refers to home directories. 2441Standing alone, i.e., 2442.Sq ~ , 2443it expands to the invoker's home directory as 2444reflected in the value of the 2445.Va home 2446shell variable. 2447When followed by a 2448name consisting of letters, digits and 2449.Sq \&- 2450characters the shell searches for a 2451user with that name and substitutes their home directory; thus 2452.Sq ~ken 2453might 2454expand to 2455.Sq /usr/ken 2456and 2457.Sq ~ken/chmach 2458to 2459.Sq /usr/ken/chmach 2460If the character 2461.Sq ~ 2462is followed by a character other than a letter or 2463.Sq / 2464or appears elsewhere 2465than at the beginning of a word, it is left undisturbed. 2466A command like 2467.Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man 2468does not, 2469therefore, do home directory substitution as one might hope. 2470.Pp 2471It is an error for a glob-pattern containing 2472.Sq * , 2473.Sq \&? , 2474.Sq \&[ 2475or 2476.Sq ~ , 2477with or 2478without 2479.Sq ^ , 2480not to match any files. 2481However, only one pattern in a list of 2482glob-patterns must match a file (so that, e.g., 2483.Sq rm *.a *.c *.o 2484would fail 2485only if there were no files in the current directory ending in 2486.Sq .a , 2487.Sq .c , 2488or 2489.Sq .o ) , 2490and if the 2491.Va nonomatch 2492shell variable is set a pattern (or list 2493of patterns) which matches nothing is left unchanged rather than causing 2494an error. 2495.Pp 2496The 2497.Va globstar 2498shell variable can be set to allow 2499.Sq ** 2500or 2501.Sq *** 2502as 2503a file glob pattern that matches any string of characters including 2504.Sq / , 2505recursively traversing any existing sub-directories. 2506For example, 2507.Sq ls **.c 2508will list all the .c files in the current directory tree. 2509If used by itself, it will match zero or more sub-directories 2510(e.g. 2511.Sq ls /usr/include/**/time.h 2512will list any file named 2513.Sq time.h 2514in the /usr/include directory tree; 2515.Sq ls /usr/include/**time.h 2516will match 2517any file in the /usr/include directory tree ending in 2518.Sq time.h ; 2519and 2520.Sq ls /usr/include/**time**.h 2521will match any .h file with 2522.Sq time 2523either 2524in a subdirectory name or in the filename itself). 2525To prevent problems with recursion, the 2526.Sq ** 2527glob-pattern will not 2528descend into a symbolic link containing a directory. 2529To override this, 2530use 2531.Sq *** 2532(+) 2533.Pp 2534The 2535.Va noglob 2536shell variable can be set to prevent filename substitution, 2537and the 2538.Va expand-glob 2539editor command, normally bound to 2540.Sq ^X-* , 2541can be 2542used to interactively expand individual filename substitutions. 2543.Ss "Directory stack substitution (+)" 2544The directory stack is a list of directories, numbered from zero, used by the 2545.Va pushd , 2546.Va popd 2547and 2548.Va dirs 2549builtin commands (q.v.). 2550.Va dirs 2551can print, store in a file, restore and clear the directory stack 2552at any time, and the 2553.Va savedirs 2554and 2555.Va dirsfile 2556shell variables can be set to 2557store the directory stack automatically on logout and restore it on login. 2558The 2559.Va dirstack 2560shell variable can be examined to see the directory stack and 2561set to put arbitrary directories into the directory stack. 2562.Pp 2563The character 2564.Sq = 2565followed by one or more digits expands to an entry in 2566the directory stack. 2567The special case 2568.Sq =- 2569expands to the last directory in 2570the stack. 2571For example, 2572.Bd -literal -offset indent 2573> dirs \&-v 25740 /usr/bin 25751 /usr/spool/uucp 25762 /usr/accts/sys 2577> echo =1 2578/usr/spool/uucp 2579> echo =0/calendar 2580/usr/bin/calendar 2581> echo =\- 2582/usr/accts/sys 2583.Ed 2584.Pp 2585The 2586.Va noglob 2587and 2588.Va nonomatch 2589shell variables and the 2590.Va expand-glob 2591editor command apply to directory stack as well as filename substitutions. 2592.Ss "Other substitutions (+)" 2593There are several more transformations involving filenames, not strictly 2594related to the above but mentioned here for completeness. 2595.Va Any 2596filename may be expanded to a full path when the 2597.Va symlinks 2598variable (q.v.) is set to 2599.Sq expand 2600Quoting prevents this expansion, and 2601the 2602.Va normalize-path 2603editor command does it on demand. 2604The 2605.Va normalize-command 2606editor command expands commands in PATH into 2607full paths on demand. 2608Finally, 2609.Va cd 2610and 2611.Va pushd 2612interpret 2613.Sq \&- 2614as the old working directory 2615(equivalent to the shell variable 2616.Va owd ) . 2617This is not a substitution at all, but an abbreviation recognized by only 2618those commands. 2619Nonetheless, it too can be prevented by quoting. 2620.Ss "Commands" 2621The next three sections describe how the shell executes commands and 2622deals with their input and output. 2623.Ss "Simple commands, pipelines and sequences" 2624A simple command is a sequence of words, the first of which specifies the 2625command to be executed. 2626A series of simple commands joined by 2627.Sq | 2628characters 2629forms a pipeline. 2630The output of each command in a pipeline is connected to the 2631input of the next. 2632.Pp 2633Simple commands and pipelines may be joined into sequences with 2634.Sq ; , 2635and will 2636be executed sequentially. 2637Commands and pipelines can also be joined into 2638sequences with 2639.Sq || 2640or 2641.Sq && , 2642indicating, as in the C language, that the second 2643is to be executed only if the first fails or succeeds respectively. 2644.Pp 2645A simple command, pipeline or sequence may be placed in parentheses, 2646.Sq () , 2647to form a simple command, which may in turn be a component of a pipeline or 2648sequence. 2649A command, pipeline or sequence can be executed 2650without waiting for it to terminate by following it with an 2651.Sq \&& . 2652.Ss "Builtin and non-builtin command execution" 2653Builtin commands are executed within the shell. 2654If any component of a 2655pipeline except the last is a builtin command, the pipeline is executed 2656in a subshell. 2657.Pp 2658Parenthesized commands are always executed in a subshell. 2659.Bd -literal -offset indent 2660(cd; pwd); pwd 2661.Ed 2662.Pp 2663thus prints the 2664.Va home 2665directory, leaving you where you were 2666(printing this after the home directory), while 2667.Bd -literal -offset indent 2668cd; pwd 2669.Ed 2670.Pp 2671leaves you in the 2672.Va home 2673directory. 2674Parenthesized commands are most often 2675used to prevent 2676.Va cd 2677from affecting the current shell. 2678.Pp 2679When a command to be executed is found not to be a builtin command the shell 2680attempts to execute the command via 2681.Xr execve 2 . 2682Each word in the variable 2683.Va path 2684names a directory in which the shell will look for the 2685command. 2686If the shell is not given a 2687.Fl f 2688option, the shell 2689hashes the names in these directories into an internal table so that it will 2690try an 2691.Xr execve 2 2692in only a directory where there is a possibility that the 2693command resides there. 2694This greatly speeds command location when a large 2695number of directories are present in the search path. This hashing mechanism is 2696not used: 2697.TP 4 2698.Bl -enum -width indent 2699.It 2700If hashing is turned explicitly off via 2701.Va unhash 2702.It 2703If the shell was given a 2704.Fl f Ar argument 2705.It 2706For each directory component of 2707.Va path 2708which does not begin with a 2709.Sq / 2710.It 2711If the command contains a 2712.Sq / 2713.El 2714.Pp 2715In the above four cases the shell concatenates each component of the path 2716vector with the given command name to form a path name of a file which it 2717then attempts to execute it. If execution is successful, the search stops. 2718.Pp 2719If the file has execute permissions but is not an executable to the system 2720(i.e., it is neither an executable binary nor a script that specifies its 2721interpreter), then it is assumed to be a file containing shell commands and 2722a new shell is spawned to read it. 2723The 2724.Va shell 2725special alias may be set 2726to specify an interpreter other than the shell itself. 2727.Pp 2728On systems which do not understand the 2729.Sq #! 2730script interpreter convention 2731the shell may be compiled to emulate it; see the 2732.Va version 2733shell 2734variable. 2735If so, the shell checks the first line of the file to 2736see if it is of the form 2737.Sq #!interpreter arg ... 2738If it is, 2739the shell starts 2740.Va interpreter 2741with the given 2742.Va arg 2743s and feeds the 2744file to it on standard input. 2745.Ss "Input/output" 2746The standard input and standard output of a command may be redirected with the 2747following syntax: 2748.Pp 2749.Bl -tag -width XXXXXXXXX -offset indent -compact 2750.It Ar < name 2751Open file 2752.Va name 2753(which is first variable, command and filename 2754expanded) as the standard input. 2755.It Ar << word 2756Read the shell input up to a line which is identical to 2757.Va word . 2758.Va word 2759is not subjected to variable, filename or command substitution, and each input 2760line is compared to 2761.Va word 2762before any substitutions are done on this input 2763line. 2764Unless a quoting 2765.Sq \e , 2766.Sq \&" 2767, 2768.Sq \&' 2769or 2770.Sq \&` 2771appears in 2772.Va word 2773variable and 2774command substitution is performed on the intervening lines, allowing 2775.Sq \e 2776to 2777quote 2778.Sq $ , 2779.Sq \e 2780and 2781.Sq \&` . 2782Commands which are substituted have all blanks, tabs, 2783and newlines preserved, except for the final newline which is dropped. 2784The 2785resultant text is placed in an anonymous temporary file which is given to the 2786command as standard input. 2787.Pp 2788.It Ar > name 2789.It Ar >! name 2790.It Ar >& name 2791.It Ar >&! name 2792The file 2793.Va name 2794is used as standard output. 2795If the file does not exist 2796then it is created; if the file exists, it is truncated, its previous contents 2797being lost. 2798.Pp 2799If the shell variable 2800.Va noclobber 2801is set, then the file must not exist or be a 2802character special file (e.g., a terminal or 2803.Sq /dev/null ) 2804or an error results. 2805This helps prevent accidental destruction of files. 2806In this case the 2807.Sq \&! 2808forms 2809can be used to suppress this check. 2810If 2811.Va notempty 2812is given in 2813.Va noclobber , 2814.Sq > 2815is allowed on empty files; 2816if 2817.Va ask 2818is set, an interacive confirmation is presented, rather than an 2819error. 2820.Pp 2821The forms involving 2822.Sq \&& 2823route the diagnostic output into the specified file as 2824well as the standard output. 2825.Va name 2826is expanded in the same way as 2827.Sq < 2828input filenames are. 2829.Pp 2830.It Ar >> name 2831.It Ar >>& name 2832.It Ar >>! name 2833.It Ar >>&! name 2834Like 2835.Sq > 2836, but appends output to the end of 2837.Va name 2838If the shell variable 2839.Va noclobber 2840is set, then it is an error for 2841the file 2842.Va not 2843to exist, unless one of the 2844.Sq \&! 2845forms is given. 2846.El 2847.Pp 2848A command receives the environment in which the shell was invoked as modified 2849by the input-output parameters and the presence of the command in a pipeline. 2850Thus, unlike some previous shells, commands run from a file of shell commands 2851have no access to the text of the commands by default; rather they receive the 2852original standard input of the shell. 2853The 2854.Sq << 2855mechanism should be used to 2856present inline data. 2857This permits shell command scripts to function as 2858components of pipelines and allows the shell to block read its input. 2859Note 2860that the default standard input for a command run detached is 2861.Va not 2862the empty file 2863.Va /dev/null , 2864but the original standard input of the shell. 2865If this is a terminal and if the process attempts to read from the terminal, 2866then the process will block and the user will be notified (see 2867.Sx Jobs ) . 2868.Pp 2869Diagnostic output may be directed through a pipe with the standard output. 2870Simply use the form 2871.Sq |& 2872rather than just 2873.Sq | . 2874.Pp 2875The shell cannot presently redirect diagnostic output without also redirecting 2876standard output, but 2877.Sq \&( command > output-file ) >& error-file 2878is often an acceptable workaround. 2879Either 2880.Va output-file 2881or 2882.Va error-file 2883may be 2884.Sq /dev/tty 2885to send output to the terminal. 2886.Ss "Features" 2887Having described how the shell accepts, parses and executes 2888command lines, we now turn to a variety of its useful features. 2889.Ss "Control flow" 2890The shell contains a number of commands which can be used to regulate the 2891flow of control in command files (shell scripts) and (in limited but 2892useful ways) from terminal input. 2893These commands all operate by forcing the 2894shell to reread or skip in its input and, due to the implementation, 2895restrict the placement of some of the commands. 2896.Pp 2897The 2898.Va foreach , 2899.Va switch , 2900and 2901.Va while 2902statements, as well as the 2903.Va if-then-else 2904form of the 2905.Va if 2906statement, require that the major 2907keywords appear in a single simple command on an input line as shown below. 2908.Pp 2909If the shell's input is not seekable, the shell buffers up input whenever 2910a loop is being read and performs seeks in this internal buffer to 2911accomplish the rereading implied by the loop. 2912(To the extent that this allows, backward 2913.Va goto 2914s will succeed on non-seekable inputs.) 2915.Ss "Expressions" 2916The 2917.Va if , 2918.Va while 2919and 2920.Va exit 2921builtin commands 2922use expressions with a common syntax. 2923The expressions can include any 2924of the operators described in the next three sections. 2925Note that the 2926.Va @ 2927builtin command (q.v.) has its own separate syntax. 2928.Ss "Logical, arithmetical and comparison operators" 2929These operators are similar to those of C and have the same precedence. 2930They include 2931.IP "" 4 2932.Bl -tag -width XXXXXX -offset indent -compact 2933.It || && | & == != =~ !~ <= >= 2934.It < > << >> + \- * / % ! ~ ( ) 2935.El 2936.Pp 2937Here the precedence increases to the right, 2938.Sq == 2939.Sq \&!= 2940.Sq =~ 2941and 2942.Sq \&!~ , 2943.Sq <= 2944.Sq >= 2945.Sq < 2946and 2947.Sq > , 2948.Sq << 2949.Sq >> , 2950.Sq + 2951and 2952.Sq \&- , 2953.Sq * 2954.Sq / 2955and 2956.Sq % 2957being, in 2958groups, at the same level. 2959The 2960.Sq == 2961.Sq \&!= 2962.Sq =~ 2963and 2964.Sq \&!~ 2965operators compare 2966their arguments as strings; all others operate on numbers. 2967The operators 2968.Sq =~ 2969and 2970.Sq \&!~ 2971are like 2972.Sq \&!= 2973and 2974.Sq == 2975except that the right hand side is a 2976glob-pattern (see 2977.Sx Filename substitution ) 2978against which the left hand operand is matched. 2979This reduces the need for use of the 2980.Va switch 2981builtin command in shell scripts when all that is really needed is 2982pattern matching. 2983.Pp 2984Null or 2985missing arguments are considered 2986.Sq 0 2987The results of all expressions are 2988strings, which represent decimal numbers. 2989It is important to note that 2990no two components of an expression can appear in the same word; except 2991when adjacent to components of expressions which are syntactically 2992significant to the parser 2993.Sq ( \&& 2994.Sq | 2995.Sq < 2996.Sq > 2997.Sq \&( 2998.Sq \&) ) 2999they should be 3000surrounded by spaces. 3001.Ss "Command exit status" 3002Commands can be executed in expressions and their exit status 3003returned by enclosing them in braces 3004.Sq ( {} ) . 3005Remember that the braces should 3006be separated from the words of the command by spaces. 3007Command executions 3008succeed, returning true, i.e., 3009.Sq 1 , 3010if the command exits with status 0, 3011otherwise they fail, returning false, i.e., 3012.Sq 0 . 3013If more detailed status 3014information is required then the command should be executed outside of an 3015expression and the 3016.Va status 3017shell variable examined. 3018.Ss "File inquiry operators" 3019Some of these operators perform true/false tests on files and related 3020objects. 3021They are of the form 3022.Fl 3023.Va op file 3024, where 3025.Va op 3026is one of 3027.Bl -tag -width XXX -offset indent -compact 3028.It Ar r 3029Read access 3030.It Ar w 3031Write access 3032.It Ar x 3033Execute access 3034.It Ar X 3035Executable in the path or shell builtin, e.g., 3036.Sq \&-X ls 3037and 3038.Sq \&-X ls\&-F 3039are 3040generally true, but 3041.Sq \&-X /bin/ls 3042is not (+) 3043.It Ar e 3044Existence 3045.It Ar o 3046Ownership 3047.It Ar z 3048Zero size 3049.It Ar s 3050Non-zero size (+) 3051.It Ar f 3052Plain file 3053.It Ar d 3054Directory 3055.It Ar l 3056Symbolic link (+) * 3057.It Ar b 3058Block special file (+) 3059.It Ar c 3060Character special file (+) 3061.It Ar p 3062Named pipe (fifo) (+) * 3063.It Ar S 3064Socket special file (+) * 3065.It Ar u 3066Set-user-ID bit is set (+) 3067.It Ar g 3068Set-group-ID bit is set (+) 3069.It Ar k 3070Sticky bit is set (+) 3071.It Ar t file 3072(which must be a digit) is an open file descriptor 3073for a terminal device (+) 3074.It Ar R 3075Has been migrated (Convex only) (+) 3076.It Ar L 3077Applies subsequent operators in a multiple-operator test to a symbolic link 3078rather than to the file to which the link points (+) * 3079.El 3080.Pp 3081.Va file 3082is command and filename expanded and then tested to 3083see if it has the specified relationship to the real user. 3084If 3085.Va file 3086does not exist or is inaccessible or, for the operators indicated by 3087.Sq * , 3088if the specified file type does not exist on the current system, 3089then all inquiries return false, i.e., 3090.Sq 0 . 3091.Pp 3092These operators may be combined for conciseness: 3093.Sq \&- 3094.Va xy file 3095is 3096equivalent to 3097.Sq \&-x file && \&-y file . 3098(+) For example, 3099.Sq \&-fx 3100is true 3101(returns 3102.Sq 1 ) 3103for plain executable files, but not for directories. 3104.Pp 3105.Va L 3106may be used in a multiple-operator test to apply subsequent operators 3107to a symbolic link rather than to the file to which the link points. 3108For example, 3109.Sq \&-lLo 3110is true for links owned by the invoking user. 3111.Va Lr , 3112.Va Lw 3113and 3114.Va Lx 3115are always true for links and false for 3116non-links. 3117.Va L 3118has a different meaning when it is the last operator 3119in a multiple-operator test; see below. 3120.Pp 3121It is possible but not useful, and sometimes misleading, to combine operators 3122which expect 3123.Va file 3124to be a file with operators which do not 3125(e.g., 3126.Va X 3127and 3128.Va t ) . 3129Following 3130.Va L 3131with a non-file operator 3132can lead to particularly strange results. 3133.Pp 3134Other operators return other information, i.e., not just 3135.Sq 0 3136or 3137.Sq 1 3138(+) 3139They have the same format as before; 3140.Va op 3141may be one of 3142.Pp 3143.Bl -tag -width XXX -offset indent -compact 3144.It Ar A 3145Last file access time, as the number of seconds since the epoch 3146.It Ar A: 3147Like 3148.Va Ar A 3149, but in timestamp format, e.g., 3150.Sq Fri May 14 16:36:10 1993 3151.It Ar M 3152Last file modification time 3153.It Ar M: 3154Like 3155.Va M 3156, but in timestamp format 3157.It Ar C 3158Last inode modification time 3159.It Ar C: 3160Like 3161.Va C 3162, but in timestamp format 3163.It Ar D 3164Device number 3165.It Ar I 3166Inode number 3167.It Ar F 3168Composite 3169.Va f 3170ile identifier, in the form 3171.Va device : 3172.Va inode 3173.It Ar L 3174The name of the file pointed to by a symbolic link 3175.It Ar N 3176Number of (hard) links 3177.It Ar P 3178Permissions, in octal, without leading zero 3179.It Ar P: 3180Like 3181.Va P 3182, with leading zero 3183.It Ar P<mode> 3184Equivalent to 3185.Sq \-P 3186.Va file 3187& 3188.Va mode 3189, e.g., 3190.Sq \-P22 3191.Va file 3192returns 3193`22' if 3194.Va file 3195is writable by group and other, 3196.Sq 20 3197if by group only, 3198and 3199.Sq 0 3200if by neither 3201.It Ar P<mode>: 3202Like 3203.Ar BP 3204.Va mode 3205, with leading zero 3206.It Ar U 3207Numeric userid 3208.It Ar U: 3209Username, or the numeric userid if the username is unknown 3210.It Ar G 3211Numeric groupid 3212.It Ar G: 3213Groupname, or the numeric groupid if the groupname is unknown 3214.It Ar Z 3215Size, in bytes 3216.El 3217.Pp 3218Only one of these operators may appear in a multiple-operator test, and it 3219must be the last. 3220Note that 3221.Va L 3222has a different meaning at the end of and 3223elsewhere in a multiple-operator test. 3224Because 3225.Sq 0 3226is a valid return value 3227for many of these operators, they do not return 3228.Sq 0 3229when they fail: most 3230return 3231.Sq \&-1 3232, and 3233.Va F 3234returns 3235.Sq \&: 3236.Pp 3237If the shell is compiled with POSIX defined (see the 3238.Va version 3239shell 3240variable), the result of a file inquiry is based on the permission bits of 3241the file and not on the result of the 3242.Va access 3243(2) system call. 3244For example, if one tests a file with 3245.Fl w\fR whose permissions would 3246ordinarily allow writing but which is on a file system mounted read-only, 3247the test will succeed in a POSIX shell but fail in a non-POSIX shell. 3248.Pp 3249File inquiry operators can also be evaluated with the 3250.Va filetest 3251builtin 3252command (q.v.) (+). 3253.Ss Jobs 3254The shell associates a 3255.Va job 3256with each pipeline. 3257It keeps a table of 3258current jobs, printed by the 3259.Va jobs 3260command, and assigns them small integer 3261numbers. 3262When a job is started asynchronously with 3263.Sq & 3264, the shell prints a 3265line which looks like 3266.IP "" 4 3267[1] 1234 3268.Pp 3269indicating that the job which was started asynchronously was job number 1 and 3270had one (top-level) process, whose process id was 1234. 3271.Pp 3272If you are running a job and wish to do something else you may hit the suspend 3273key (usually 3274.Sq ^Z ) , 3275which sends a STOP signal to the current job. 3276The shell will then normally 3277indicate that the job has been 3278.Sq Suspended 3279and print another prompt. 3280If the 3281.Va listjobs 3282shell variable is set, all jobs will be listed 3283like the 3284.Va jobs 3285builtin command; if it is set to 3286.Sq long 3287the listing will 3288be in long format, like 3289.Sq jobs \&-l 3290You can then manipulate the state of the suspended job. 3291You can put it in the 3292.Dq background 3293 with the 3294.Va bg 3295command or run some other commands and 3296eventually bring the job back into the 3297.Sq foreground 3298' with 3299.Va fg 3300(See also the 3301.Va run-fg-editor 3302editor command.) 3303A 3304.Sq ^Z 3305takes effect immediately and is like an interrupt 3306in that pending output and unread input are discarded when it is typed. 3307The 3308.Va wait 3309builtin command causes the shell to wait for all background 3310jobs to complete. 3311.Pp 3312The 3313.Sq ^] 3314key sends a delayed suspend signal, which does not generate a STOP 3315signal until a program attempts to 3316.Va read 3317(2) it, to the current job. 3318This can usefully be typed ahead when you have prepared some commands for a 3319job which you wish to stop after it has read them. 3320The 3321.Sq ^Y 3322key performs this function in 3323.Xr csh 1 3324; in 3325.Nm 3326, 3327`^Y' is an editing command. 3328(+) 3329.Pp 3330A job being run in the background stops if it tries to read from the 3331terminal. 3332Background jobs are normally allowed to produce output, but this can 3333be disabled by giving the command 3334.Sq stty tostop 3335If you set this tty option, 3336then background jobs will stop when they try to produce output like they do 3337when they try to read input. 3338.Pp 3339There are several ways to refer to jobs in the shell. 3340The character 3341.Sq % 3342introduces a job name. 3343If you wish to refer to job number 1, you can name it 3344as 3345.Sq %1 3346Just naming a job brings it to the foreground; thus 3347.Sq %1 3348is a synonym 3349for 3350.Sq fg %1 3351, bringing job 1 back into the foreground. 3352Similarly, saying 3353.Sq %1 & 3354resumes job 1 in the background, just like 3355.Sq bg %1 3356A job can also be named 3357by an unambiguous prefix of the string typed in to start it: 3358.Sq %ex 3359would 3360normally restart a suspended 3361.Va ex 3362(1) job, if there were only one suspended 3363job whose name began with the string 3364.Sq ex 3365It is also possible to say 3366`%? 3367.Va string 3368' to specify a job whose text contains 3369.Va string 3370, if there 3371is only one such job. 3372.Pp 3373The shell maintains a notion of the current and previous jobs. 3374In output 3375pertaining to jobs, the current job is marked with a 3376.Sq + 3377and the previous job 3378with a 3379.Sq \- 3380The abbreviations 3381.Sq %+ 3382, 3383.Sq % 3384, and (by analogy with the syntax of 3385the 3386.Va history 3387mechanism) 3388.Sq %% 3389all refer to the current job, and 3390.Sq %\- 3391refers 3392to the previous job. 3393.Pp 3394The job control mechanism requires that the 3395.Va stty 3396(1) option 3397.Sq new 3398be set 3399on some systems. 3400It is an artifact from a 3401.Sq new 3402implementation of the tty 3403driver which allows generation of interrupt characters from the keyboard to 3404tell jobs to stop. 3405See 3406.Va stty 3407(1) and the 3408.Va setty 3409builtin command for 3410details on setting options in the new tty driver. 3411.Ss "Status reporting" 3412The shell learns immediately whenever a process changes state. 3413It normally 3414informs you whenever a job becomes blocked so that no further progress is 3415possible, but only right before it prints a prompt. 3416This is done so that it 3417does not otherwise disturb your work. 3418If, however, you set the shell variable 3419.Va notify 3420, the shell will notify you immediately of changes of status in 3421background jobs. 3422There is also a shell command 3423.Va notify 3424which marks a 3425single process so that its status changes will be immediately reported. 3426By 3427default 3428.Va notify 3429marks the current process; simply say 3430.Sq notify 3431after 3432starting a background job to mark it. 3433.Pp 3434When you try to leave the shell while jobs are stopped, you will be 3435warned that 3436.Sq There are suspended jobs. 3437You may use the 3438.Va jobs 3439command to 3440see what they are. 3441If you do this or immediately try to exit again, the shell 3442will not warn you a second time, and the suspended jobs will be terminated. 3443.Ss "Automatic, periodic and timed events (+)" 3444There are various ways to run commands and take other actions automatically 3445at various times in the 3446.Sq `life cycle 3447' of the shell. 3448They are summarized here, 3449and described in detail under the appropriate 3450.Va Builtin commands 3451, 3452.Va Special shell variables 3453and 3454.Va Special aliases 3455.Pp 3456The 3457.Va sched 3458builtin command puts commands in a scheduled-event list, 3459to be executed by the shell at a given time. 3460.Pp 3461The 3462.Va beepcmd 3463, 3464.Va cwdcmd 3465, 3466.Va periodic 3467, 3468.Va precmd 3469, 3470.Va postcmd 3471, 3472and 3473.Va jobcmd 3474.Va Special aliases 3475can be set, respectively, to execute commands when the shell wants 3476to ring the bell, when the working directory changes, every 3477.Va tperiod 3478minutes, before each prompt, before each command gets executed, after each 3479command gets executed, and when a job is started or is brought into the 3480foreground. 3481.Pp 3482The 3483.Va autologout 3484shell variable can be set to log out or lock the shell 3485after a given number of minutes of inactivity. 3486.Pp 3487The 3488.Va mail 3489shell variable can be set to check for new mail periodically. 3490.Pp 3491The 3492.Va printexitvalue 3493shell variable can be set to print the exit status 3494of commands which exit with a status other than zero. 3495.Pp 3496The 3497.Va rmstar 3498shell variable can be set to ask the user, when 3499.Sq rm * 3500is 3501typed, if that is really what was meant. 3502.Pp 3503The 3504.Va time 3505shell variable can be set to execute the 3506.Va time 3507builtin 3508command after the completion of any process that takes more than a given 3509number of CPU seconds. 3510.Pp 3511The 3512.Va watch 3513and 3514.Va who 3515shell variables can be set to report when 3516selected users log in or out, and the 3517.Va log 3518builtin command reports 3519on those users at any time. 3520.Ss "Native Language System support (+)" 3521The shell is eight bit clean 3522(if so compiled; see the 3523.Va version 3524shell variable) 3525and thus supports character sets needing this capability. 3526NLS support differs depending on whether or not 3527the shell was compiled to use the system's NLS (again, see 3528.Va version 3529). 3530In either case, 7-bit ASCII is the default character code 3531(e.g., the classification of which characters are printable) and sorting, 3532and changing the 3533.Va LANG 3534or 3535.Va LC_CTYPE 3536environment variables 3537causes a check for possible changes in these respects. 3538.Pp 3539When using the system's NLS, the 3540.Va setlocale 3541(3) function is called 3542to determine appropriate character code/classification and sorting 3543(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code). 3544This function typically examines the 3545.Va LANG 3546and 3547.Va LC_CTYPE 3548environment variables; refer to the system documentation for further details. 3549When not using the system's NLS, the shell simulates it by assuming that the 3550ISO 8859-1 character set is used 3551whenever either of the 3552.Va LANG 3553and 3554.Va LC_CTYPE 3555variables are set, regardless of 3556their values. 3557Sorting is not affected for the simulated NLS. 3558.Pp 3559In addition, with both real and simulated NLS, all printable 3560characters in the range \e200\-\e377, i.e., those that have 3561M- 3562.Va char 3563bindings, are automatically rebound to 3564.Va self-insert-command 3565The corresponding binding for the escape- 3566.Va char 3567sequence, if any, is 3568left alone. 3569These characters are not rebound if the 3570.Va NOREBIND 3571environment variable 3572is set. 3573This may be useful for the simulated NLS or a primitive real NLS 3574which assumes full ISO 8859-1. 3575Otherwise, all M- 3576.Va char 3577bindings in the 3578range \e240\-\e377 are effectively undone. 3579Explicitly rebinding the relevant keys with 3580.Va bindkey 3581is of course still possible. 3582.Pp 3583Unknown characters (i.e., those that are neither printable nor control 3584characters) are printed in the format \ennn. 3585If the tty is not in 8 bit mode, other 8 bit characters are printed by 3586converting them to ASCII and using standout mode. 3587The shell 3588never changes the 7/8 bit mode of the tty and tracks user-initiated 3589changes of 7/8 bit mode. 3590NLS users (or, for that matter, those who want to 3591use a meta key) may need to explicitly set 3592the tty in 8 bit mode through the appropriate 3593.Va stty 3594(1) 3595command in, e.g., the 3596.Va ~/.login 3597file. 3598.Ss "OS variant support (+)" 3599A number of new builtin commands are provided to support features in 3600particular operating systems. 3601All are described in detail in the 3602.Va Builtin commands 3603section. 3604.Pp 3605On systems that support TCF (aix-ibm370, aix-ps2), 3606.Va getspath 3607and 3608.Va setspath 3609get and set the system execution path, 3610.Va getxvers 3611and 3612.Va setxvers 3613get and set the experimental version prefix 3614and 3615.Va migrate 3616migrates processes between sites. 3617The 3618.Va jobs 3619builtin 3620prints the site on which each job is executing. 3621.Pp 3622Under BS2000, 3623.Va bs2cmd 3624executes commands of the underlying BS2000/OSD 3625operating system. 3626.Pp 3627Under Domain/OS, 3628.Va inlib 3629adds shared libraries to the current environment, 3630.Va rootnode 3631changes the rootnode and 3632.Va ver 3633changes the systype. 3634.Pp 3635Under Mach, 3636.Va setpath 3637is equivalent to Mach's 3638.Va setpath 3639(1). 3640.Pp 3641Under Masscomp/RTU and Harris CX/UX, 3642.Va universe 3643sets the universe. 3644.Pp 3645Under Harris CX/UX, 3646.Va ucb 3647or 3648.Va att 3649runs a command under the specified 3650universe. 3651.Pp 3652Under Convex/OS, 3653.Va warp 3654prints or sets the universe. 3655.Pp 3656The 3657.Va VENDOR 3658, 3659.Va OSTYPE 3660and 3661.Va MACHTYPE 3662environment variables 3663indicate respectively the vendor, operating system and machine type 3664(microprocessor class or machine model) of the 3665system on which the shell thinks it is running. 3666These are particularly useful when sharing one's home directory between several 3667types of machines; one can, for example, 3668.IP "" 4 3669set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .) 3670.Pp 3671in one's 3672.Va ~/.login 3673and put executables compiled for each machine in the 3674appropriate directory. 3675.Pp 3676The 3677.Va version 3678shell 3679variable indicates what options were chosen when the shell was compiled. 3680.Pp 3681Note also the 3682.Va newgrp 3683builtin, the 3684.Va afsuser 3685and 3686.Va echo_style 3687shell variables and the system-dependent locations of 3688the shell's input files (see 3689.Va FILES 3690). 3691.Ss "Signal handling" 3692Login shells ignore interrupts when reading the file 3693.Va ~/.logout 3694The shell ignores quit signals unless started with 3695.Fl q\fR. 3696Login shells catch the terminate signal, but non-login shells inherit the 3697terminate behavior from their parents. 3698Other signals have the values which the shell inherited from its parent. 3699.Pp 3700In shell scripts, the shell's handling of interrupt and terminate signals 3701can be controlled with 3702.Va onintr 3703, and its handling of hangups can be 3704controlled with 3705.Va hup 3706and 3707.Va nohup 3708.Pp 3709The shell exits on a hangup (see also the 3710.Va logout 3711shell variable). 3712By 3713default, the shell's children do too, but the shell does not send them a 3714hangup when it exits. 3715.Va hup 3716arranges for the shell to send a hangup to 3717a child when it exits, and 3718.Va nohup 3719sets a child to ignore hangups. 3720.Ss "Terminal management (+)" 3721The shell uses three different sets of terminal ( 3722.Dq tty 3723) modes: 3724`edit', used when editing, 3725.Sq quote 3726, used when quoting literal characters, 3727and 3728.Sq execute 3729, used when executing commands. 3730The shell holds some settings in each mode constant, so commands which leave 3731the tty in a confused state do not interfere with the shell. 3732The shell also matches changes in the speed and padding of the tty. 3733The list of tty modes that are kept constant 3734can be examined and modified with the 3735.Va setty 3736builtin. 3737Note that although the editor uses CBREAK mode (or its equivalent), 3738it takes typed-ahead characters anyway. 3739.Pp 3740The 3741.Va echotc 3742, 3743.Va settc 3744and 3745.Va telltc 3746commands can be used to 3747manipulate and debug terminal capabilities from the command line. 3748.Pp 3749On systems that support SIGWINCH or SIGWINDOW, the shell 3750adapts to window resizing automatically and adjusts the environment 3751variables 3752.Va LINES 3753and 3754.Va COLUMNS 3755if set. 3756If the environment 3757variable 3758.Va TERMCAP 3759contains li# and co# fields, the shell adjusts 3760them to reflect the new window size. 3761.Sh REFERENCE 3762The next sections of this manual describe all of the available 3763.Va Builtin commands 3764, 3765.Va Special aliases 3766and 3767.Va Special shell variables 3768.Ss "Builtin commands" 3769.Bl -tag -width XXXXXXX -offset indent 3770.It Ar %job 3771A synonym for the 3772.Va fg 3773builtin command. 3774.It Ar %job \&& 3775A synonym for the 3776.Va bg 3777builtin command. 3778.It Ar \&: 3779Does nothing, successfully. 3780.Pp 3781.It Ar @ 3782.It Ar @ name = expr 3783.It Ar @ name[index] = expr 3784.It Ar @ name++|-- 3785.It Ar @name[index]++|-- 3786The first form prints the values of all shell variables. 3787.Pp 3788The second form assigns the value of 3789.Va expr 3790to 3791.Va name 3792The third form assigns the value of 3793.Va expr 3794to the 3795.Va index 3796'th 3797component of 3798.Va name 3799; both 3800.Va name 3801and its 3802.Va index 3803'th component 3804must already exist. 3805.Pp 3806.Va expr 3807may contain the operators 3808.Sq * 3809, 3810.Sq + 3811, etc., as in C. 3812If 3813.Va expr 3814contains 3815.Sq < 3816, 3817.Sq > 3818, 3819.Sq & 3820or 3821.Sq 3822then at least that part of 3823.Va expr 3824must be placed within 3825.Sq () 3826Note that the syntax of 3827.Va expr 3828has nothing to do with that described 3829under 3830.Va Expressions 3831.Pp 3832The fourth and fifth forms increment ( 3833.Sq ++ ) 3834or decrement 3835.Sq ( -- ) 3836.Va name 3837or its 3838.Va index 3839'th component. 3840.Pp 3841The space between 3842.Sq @ 3843and 3844.Va name 3845is required. 3846The spaces between 3847.Va name 3848and 3849.Sq = 3850and between 3851.Sq = 3852and 3853.Va expr 3854are optional. 3855Components of 3856.Va expr 3857must be separated by spaces. 3858.It Ar alias[name[wordlist]] 3859Without arguments, prints all aliases. 3860With 3861.Va name 3862, prints the alias for name. 3863With 3864.Va name 3865and 3866.Va wordlist 3867, assigns 3868.Va wordlist 3869as the alias of 3870.Va name 3871.Va wordlist 3872is command and filename substituted. 3873.Va name 3874may not be 3875.Sq alias 3876or 3877.Sq unalias 3878See also the 3879.Va unalias 3880builtin command. 3881.It Ar alloc 3882Shows the amount of dynamic memory acquired, broken down into used and free 3883memory. 3884With an argument shows the number of free and used blocks in each size 3885category. 3886The categories start at size 8 and double at each step. 3887This 3888command's output may vary across system types, because systems other than the VAX 3889may use a different memory allocator. 3890.TP 8 3891.It Ar bg[%job...] 3892Puts the specified jobs (or, without arguments, the current job) 3893into the background, continuing each if it is stopped. 3894.Va job 3895may be a number, a string, 3896.Sq 3897, 3898.Sq % 3899, 3900.Sq + 3901or 3902.Sq \- 3903as described 3904under 3905.Va Jobs 3906.Pp 3907.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+) 3908.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+) 3909.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+) 3910.\" .It Ar macro can't take too many words, so I used \fB in the previous tags 3911Without options, the first form lists all bound keys and the editor command to which each is bound, 3912the second form lists the editor command to which 3913.Va key 3914is bound and 3915the third form binds the editor command 3916.Va command 3917to 3918.Va key 3919Options include: 3920.Pp 3921.Bl -tag -width XXX -compact 3922.It Fl l 3923Lists all editor commands and a short description of each. 3924.It Fl d 3925Binds all keys to the standard bindings for the default editor, 3926as per 3927.Va -e 3928and 3929.Va -v 3930below. 3931.It Fl e 3932Binds all keys to 3933.Va emacs 3934(1)\-style bindings. 3935Unsets 3936.Va vimode 3937.It Fl v 3938Binds all keys to 3939.Va vi 3940(1)\-style bindings. 3941Sets 3942.Va vimode 3943.It Fl a 3944Lists or changes key-bindings in the alternative key map. 3945This is the key map used in 3946.Va vimode 3947command mode. 3948.It Fl b 3949.Va key 3950is interpreted as 3951a control character written ^ 3952.Va character 3953(e.g., 3954.Sq ^A 3955) or 3956C- 3957.Va character 3958(e.g., 3959.Sq C-A 3960), 3961a meta character written M- 3962.Va character 3963(e.g., 3964.Sq M-A 3965), 3966a function key written F- 3967.Va string 3968(e.g., 3969.Sq F-string 3970), 3971or an extended prefix key written X- 3972.Va character 3973(e.g., 3974.Sq X-A 3975). 3976.It Fl k 3977.Va key 3978is interpreted as a symbolic arrow key name, which may be one of 3979`down', 3980.Sq up 3981, 3982.Sq left 3983or 3984.Sq right 3985.It Fl r 3986Removes 3987.Va key 3988's binding. 3989Be careful: 3990.Sq bindkey \-r 3991does 3992.Va not 3993bind 3994.Va key 3995to 3996.Va self-insert-command 3997(q.v.), it unbinds 3998.Va key 3999completely. 4000.It Fl c 4001.Va command 4002is interpreted as a builtin or external command instead of an 4003editor command. 4004.It Fl s 4005.Va command 4006is taken as a literal string and treated as terminal input 4007when 4008.Va key 4009is typed. 4010Bound keys in 4011.Va command 4012are themselves 4013reinterpreted, and this continues for ten levels of interpretation. 4014.It Fl \&- 4015Forces a break from option processing, so the next word is taken as 4016.Va key 4017even if it begins with '\&-'. 4018.It Fl u 4019(or any invalid option) 4020Prints a usage message. 4021.El 4022.Pp 4023.Va key 4024may be a single character or a string. 4025If a command is bound to a string, the first character of the string is bound to 4026.Va sequence-lead-in 4027and the entire string is bound to the command. 4028.Pp 4029Control characters in 4030.Va key 4031can be literal (they can be typed by preceding 4032them with the editor command 4033.Va quoted-insert 4034, normally bound to 4035.Sq ^V 4036) or 4037written caret-character style, e.g., 4038.Sq ^A 4039Delete is written 4040.Sq ^? 4041(caret-question mark). 4042.Va key 4043and 4044.Va command 4045can contain backslashed 4046escape sequences (in the style of System V 4047.Va echo 4048(1)) as follows: 4049.Pp 4050.Bl -tag -width XXXX -compact -offset indent 4051.It \ea 4052Bell 4053.It \eb 4054Backspace 4055.It \ee 4056Escape 4057.It \ef 4058Form feed 4059.It \en 4060Newline 4061.It \er 4062Carriage return 4063.It \et 4064Horizontal tab 4065.It \ev 4066Vertical tab 4067.It \e\fInnn 4068The ASCII character corresponding to the octal number 4069.Va nnn 4070.El 4071.Pp 4072`\e' nullifies the special meaning of the following character, if it has 4073any, notably 4074.Sq \e 4075and 4076.Sq ^ 4077.It bs2cmd Va bs2000-command 4078(+) 4079Passes 4080.Va bs2000-command 4081to the BS2000 command interpreter for 4082execution. Only non-interactive commands can be executed, and it is 4083not possible to execute any command that would overlay the image 4084of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only) 4085.It break 4086Causes execution to resume after the 4087.Va end 4088of the nearest 4089enclosing 4090.Va foreach 4091or 4092.Va while 4093The remaining commands on the 4094current line are executed. 4095Multi-level breaks are thus 4096possible by writing them all on one line. 4097.It breaksw 4098Causes a break from a 4099.Va switch 4100, resuming after the 4101.Va endsw 4102 4103.It builtins \fR(+) 4104Prints the names of all builtin commands. 4105 4106.It bye \fR(+) 4107A synonym for the 4108.Va logout 4109builtin command. 4110Available only if the shell was so compiled; 4111see the 4112.Va version 4113shell variable. 4114 4115.It case \fIlabel\fB: 4116A label in a 4117.Va switch 4118statement as discussed below. 4119 4120.It cd \fR[ 4121.Fl p\fR] [ 4122.Fl l\fR] [ 4123.Fl n\fR| 4124.Fl v\fR] [\I--\fR] [ 4125.Va name 4126] 4127If a directory 4128.Va name 4129is given, changes the shell's working directory 4130to 4131.Va name 4132If not, changes to 4133.Va home 4134, unless the 4135.Va cdtohome 4136variable is not set, in which case a 4137.Va name 4138is required. 4139If 4140.Va name 4141is 4142.Sq \- 4143it is interpreted as the previous working directory 4144(see 4145.Va Other substitutions 4146). 4147(+) 4148If 4149.Va name 4150is not a subdirectory of the current directory 4151(and does not begin with 4152.Sq / 4153, 4154.Sq ./ 4155or 4156.Sq ../ 4157), each component of the variable 4158.Va cdpath 4159is checked to see if it has a subdirectory 4160.Va name 4161Finally, if 4162all else fails but 4163.Va name 4164is a shell variable whose value 4165begins with 4166.Sq / 4167or '.', then this is tried to see if it is a directory, and 4168the 4169.Fl p\fR option is implied. 4170.RS +8 4171.Pp 4172With 4173.Fl p\fR, prints the final directory stack, just like 4174.Va dirs 4175The 4176.Fl l\fR, 4177.Fl n\fR and 4178.Fl v\fR flags have the same effect on 4179.Va cd 4180as on 4181.Va dirs 4182, and they imply 4183.Fl p\fR. 4184(+) 4185Using 4186.Fl \-\fR forces a break from option processing so the next word 4187is taken as the directory 4188.Va name 4189even if it begins with '\-'. (+) 4190.Pp 4191See also the 4192.Va implicitcd 4193and 4194.Va cdtohome 4195shell variables. 4196.RE 4197 4198.It chdir 4199A synonym for the 4200.Va cd 4201builtin command. 4202 4203.It complete \fR[ 4204.Va command 4205[\fIword\fB/\fIpattern\fB/ 4206.Va list 4207[\fB: 4208.Va select 4209] 4210.Va / 4211[[ 4212.Va suffix 4213] 4214.Va / 4215] ...]] (+) 4216Without arguments, lists all completions. 4217With 4218.Va command 4219, lists completions for 4220.Va command 4221With 4222.Va command 4223and 4224.Va word 4225etc., defines completions. 4226.RS +8 4227.Pp 4228.Va command 4229may be a full command name or a glob-pattern 4230(see 4231.Va Filename substitution 4232). 4233It can begin with 4234.Sq \- 4235to indicate that 4236completion should be used only when 4237.Va command 4238is ambiguous. 4239.Pp 4240.Va word 4241specifies which word relative to the current word 4242is to be completed, and may be one of the following: 4243.Pp 4244.PD 0 4245.RS +4 4246.TP 4 4247.It c 4248Current-word completion. 4249.Va pattern 4250is a glob-pattern which must match the beginning of the current word on 4251the command line. 4252.Va pattern 4253is ignored when completing the current word. 4254.TP 4 4255.It C 4256Like 4257.Va c 4258, but includes 4259.Va pattern 4260when completing the current word. 4261.TP 4 4262.It n 4263Next-word completion. 4264.Va pattern 4265is a glob-pattern which must match the beginning of the previous word on 4266the command line. 4267.TP 4 4268.It N 4269Like 4270.Va n 4271, but must match the beginning of the word two before the current word. 4272.TP 4 4273.It p 4274Position-dependent completion. 4275.Va pattern 4276is a numeric range, with the same syntax used to index shell 4277variables, which must include the current word. 4278.PD 4279.RE 4280.Pp 4281.Va list 4282, the list of possible completions, may be one of the following: 4283.Pp 4284.Bl -tag 4285.It a 4286Aliases 4287.It b 4288Bindings (editor commands) 4289.It c 4290Commands (builtin or external commands) 4291.It C 4292External commands which begin with the supplied path prefix 4293.It d 4294Directories 4295.It D 4296Directories which begin with the supplied path prefix 4297.It e 4298Environment variables 4299.It f 4300Filenames 4301.It F 4302Filenames which begin with the supplied path prefix 4303.It g 4304Groupnames 4305.It j 4306Jobs 4307.It l 4308Limits 4309.It n 4310Nothing 4311.It s 4312Shell variables 4313.It S 4314Signals 4315.It t 4316Plain ( 4317.Dq text ) 4318files 4319.It T 4320Plain ( 4321.Dq text ) 4322files which begin with the supplied path prefix 4323.It v 4324Any variables 4325.It u 4326Usernames 4327.It x 4328Like 4329.Va n , 4330but prints 4331.Va select 4332when 4333.Va list-choices 4334is used. 4335.It X 4336Completions 4337$ 4338.Va var 4339Words from the variable 4340.Va var 4341(...) 4342Words from the given list 4343\`...\` 4344Words from the output of command 4345.El 4346.Pp 4347.Va select 4348is an optional glob-pattern. 4349If given, words from only 4350.Va list 4351that match 4352.Va select 4353are considered 4354and the 4355.Va fignore 4356shell variable is ignored. 4357The last three types of completion may not have a 4358.Va select 4359pattern, and 4360.Va x 4361uses 4362.Va select 4363as an explanatory message when 4364the 4365.Va list-choices 4366editor command is used. 4367.Pp 4368.Va suffix 4369is a single character to be appended to a successful 4370completion. 4371If null, no character is appended. 4372If omitted (in which 4373case the fourth delimiter can also be omitted), a slash is appended to 4374directories and a space to other words. 4375.Pp 4376.Va command 4377invoked from \`...\` version has additional environment 4378variable set, the variable name is \% 4379.Va COMMAND_LINE 4380\% and 4381contains (as its name indicates) contents of the current (already 4382typed in) command line. One can examine and use contents of the 4383\% 4384.Va COMMAND_LINE 4385\% variable in her custom script to build more 4386sophisticated completions (see completion for svn(1) included in 4387this package). 4388.Pp 4389Now for some examples. 4390Some commands take only directories as arguments, 4391so there's no point completing plain files. 4392.IP "" 4 4393> complete cd 'p/1/d/' 4394.Pp 4395completes only the first word following 4396.Sq cd 4397(`p/1') with a directory. 4398.Va p 4399-type completion can also be used to narrow down command completion: 4400.IP "" 4 4401> co[^D] 4402.br 4403complete compress 4404.br 4405> complete \-co* 'p/0/(compress)/' 4406.br 4407> co[^D] 4408.br 4409> compress 4410.Pp 4411This completion completes commands (words in position 0, 4412.Sq p/0 4413) 4414which begin with 4415.Sq co 4416(thus matching 4417.Sq co* 4418) to 4419.Sq compress 4420(the only 4421word in the list). 4422The leading 4423.Sq \- 4424indicates that this completion is to be used with only 4425ambiguous commands. 4426.IP "" 4 4427> complete find 'n/\-user/u/' 4428.Pp 4429is an example of 4430.Va n 4431-type completion. 4432Any word following 4433.Sq find 4434and 4435immediately following 4436.Sq \-user 4437is completed from the list of users. 4438.IP "" 4 4439> complete cc 'c/\-I/d/' 4440.Pp 4441demonstrates 4442.Va c 4443-type completion. 4444Any word following 4445.Sq cc 4446and beginning 4447with 4448.Sq \-I 4449is completed as a directory. 4450`\-I' is not taken as part of the 4451directory because we used lowercase 4452.Va c 4453.Pp 4454Different 4455.Va list 4456s are useful with different commands. 4457.IP "" 4 4458> complete alias 'p/1/a/' 4459.br 4460> complete man 'p/*/c/' 4461.br 4462> complete set 'p/1/s/' 4463.br 4464> complete true 'p/1/x:Truth has no options./' 4465.Pp 4466These complete words following 4467.Sq alias 4468with aliases, 4469.Sq man 4470with commands, 4471and 4472.Sq set 4473with shell variables. 4474`true' doesn't have any options, so 4475.Va x 4476does nothing when completion 4477is attempted and prints 4478.Sq Truth has no options. 4479when completion choices are listed. 4480.Pp 4481Note that the 4482.Va man 4483example, and several other examples below, could 4484just as well have used 'c/*' or 'n/*' as 'p/*'. 4485.Pp 4486Words can be completed from a variable evaluated at completion time, 4487.IP "" 4 4488> complete ftp 'p/1/$hostnames/' 4489.br 4490> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu) 4491.br 4492> ftp [^D] 4493.br 4494rtfm.mit.edu tesla.ee.cornell.edu 4495.br 4496> ftp [^C] 4497.br 4498> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net) 4499.br 4500> ftp [^D] 4501.br 4502rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net 4503.Pp 4504or from a command run at completion time: 4505.IP "" 4 4506> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/' 4507.br 4508> kill \-9 [^D] 4509.br 451023113 23377 23380 23406 23429 23529 23530 PID 4511.Pp 4512Note that the 4513.Va complete 4514command does not itself quote its arguments, 4515so the braces, space and 4516.Sq $ 4517in 4518.Sq {print $1} 4519must be quoted explicitly. 4520.Pp 4521One command can have multiple completions: 4522.IP "" 4 4523> complete dbx 'p/2/(core)/' 'p/*/c/' 4524.Pp 4525completes the second argument to 4526.Sq dbx 4527with the word 4528.Sq core 4529and all other 4530arguments with commands. 4531Note that the positional completion is specified 4532before the next-word completion. 4533Because completions are evaluated from left to right, if 4534the next-word completion were specified first it would always match 4535and the positional completion would never be executed. 4536This is a 4537common mistake when defining a completion. 4538.Pp 4539The 4540.Va select 4541pattern is useful when a command takes files with only 4542particular forms as arguments. 4543For example, 4544.IP "" 4 4545> complete cc 'p/*/f:*.[cao]/' 4546.Pp 4547completes 4548.Sq cc 4549arguments to files ending in only 4550.Sq .c 4551, 4552.Sq .a 4553, or 4554.Sq .o 4555.Va select 4556can also exclude files, using negation of a glob-pattern as 4557described under 4558.Va Filename substitution 4559One might use 4560.IP "" 4 4561> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/' 4562.Pp 4563to exclude precious source code from 4564.Sq rm 4565completion. 4566Of course, one 4567could still type excluded names manually or override the completion 4568mechanism using the 4569.Va complete-word-raw 4570or 4571.Va list-choices-raw 4572editor commands (q.v.). 4573.Pp 4574The 4575.Sq C 4576, 4577.Sq D 4578, 4579.Sq F 4580and 4581.Sq T 4582 4583.Va list 4584s are like 4585.Sq c 4586, 4587.Sq d 4588, 4589.Sq f 4590and 4591.Sq t 4592respectively, but they use the 4593.Va select 4594argument in a different way: to 4595restrict completion to files beginning with a particular path prefix. 4596For 4597example, the Elm mail program uses 4598.Sq = 4599as an abbreviation for one's mail 4600directory. 4601One might use 4602.IP "" 4 4603> complete elm c@=@F:$HOME/Mail/@ 4604.Pp 4605to complete 4606.Sq elm \-f = 4607as if it were 4608.Sq elm \-f ~/Mail/ 4609Note that we used 4610.Sq @ 4611instead of 4612.Sq / 4613to avoid confusion with the 4614.Va select 4615argument, and we used 4616`$HOME' instead of 4617.Sq ~ 4618because home directory substitution works at only the 4619beginning of a word. 4620.Pp 4621.Va suffix 4622is used to add a nonstandard suffix 4623(not space or 4624.Sq / 4625for directories) to completed words. 4626.IP "" 4 4627> complete finger 'c/*@/$hostnames/' 'p/1/u/@' 4628.Pp 4629completes arguments to 4630.Sq finger 4631from the list of users, appends an 4632.Sq @ 4633, 4634and then completes after the 4635.Sq @ 4636from the 4637.Sq hostnames 4638variable. 4639Note 4640again the order in which the completions are specified. 4641.Pp 4642Finally, here's a complex example for inspiration: 4643.IP "" 4 4644> complete find \e 4645.br 4646\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e 4647.br 4648\&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e 4649.br 4650\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e 4651.br 4652\&'n/\-type/(b c d f l p s)/' \e 4653.br 4654\'c/\-/(name newer cpio ncpio exec ok user \e 4655.br 4656group fstype type atime ctime depth inum \e 4657.br 4658ls mtime nogroup nouser perm print prune \e 4659.br 4660size xdev)/' \e 4661.br 4662\&'p/*/d/' 4663.Pp 4664This completes words following 4665.Sq \-name 4666, 4667.Sq \-newer 4668, 4669.Sq \-cpio 4670or 4671.Sq ncpio 4672(note the pattern which matches both) to files, 4673words following 4674.Sq \-exec 4675or 4676.Sq \-ok 4677to commands, words following 4678.Sq user 4679and 4680.Sq group 4681to users and groups respectively 4682and words following 4683.Sq \-fstype 4684or 4685.Sq \-type 4686to members of the 4687given lists. 4688It also completes the switches themselves from the given list 4689(note the use of 4690.Va c 4691-type completion) 4692and completes anything not otherwise completed to a directory. 4693Whew. 4694.Pp 4695Remember that programmed completions are ignored if the word being completed 4696is a tilde substitution (beginning with 4697.Sq ~ 4698) or a variable (beginning with 4699.Sq $ 4700). 4701See also the 4702.Va uncomplete 4703builtin command. 4704.RE 4705.TP 8 4706.B continue 4707Continues execution of the nearest enclosing 4708.Va while 4709or 4710.Va foreach 4711The rest of the commands on the current line are executed. 4712.TP 8 4713.B default: 4714Labels the default case in a 4715.Va switch 4716statement. 4717It should come after all 4718.Va case 4719labels. 4720.Pp 4721.B dirs \fR[ 4722.Fl l\fR] [ 4723.Fl n\fR| 4724.Fl v\fR] 4725.br 4726.B dirs \-S\fR| 4727.Fl L \fR[ 4728.Va filename 4729] (+) 4730.PD 0 4731.TP 8 4732.B dirs \-c \fR(+) 4733The first form prints the directory stack. 4734The top of the stack is at the 4735left and the first directory in the stack is the current directory. 4736With 4737.Fl l\fR, 4738.Sq ~ 4739or 4740.Sq ~\fIname\fP 4741in the output is expanded explicitly 4742to 4743.Va home 4744or the pathname of the home directory for user \fIname\fP. 4745(+) 4746With 4747.Fl n\fR, entries are wrapped before they reach the edge of the screen. 4748(+) 4749With 4750.Fl v\fR, entries are printed one per line, preceded by their stack positions. 4751(+) 4752If more than one of 4753.Fl n\fR or 4754.Fl v\fR is given, 4755.Fl v\fR takes precedence. 4756.Fl p\fR is accepted but does nothing. 4757.PD 4758.RS +8 4759.Pp 4760With 4761.Fl S\fR, the second form saves the directory stack to 4762.Va filename 4763as a series of 4764.Va cd 4765and 4766.Va pushd 4767commands. 4768With 4769.Fl L\fR, the shell sources 4770.Va filename 4771, which is presumably 4772a directory stack file saved by the 4773.Fl S\fR option or the 4774.Va savedirs 4775mechanism. 4776In either case, 4777.Va dirsfile 4778is used if 4779.Va filename 4780is not given and 4781.Va ~/.cshdirs 4782is used if 4783.Va dirsfile 4784is unset. 4785.Pp 4786Note that login shells do the equivalent of 4787.Sq dirs \-L 4788on startup 4789and, if 4790.Va savedirs 4791is set, 4792.Sq dirs \-S 4793before exiting. 4794Because only 4795.Va ~/.tcshrc 4796is normally sourced before 4797.Va ~/.cshdirs 4798, 4799.Va dirsfile 4800should be set in 4801.Va ~/.tcshrc 4802rather than 4803.Va ~/.login 4804.Pp 4805The last form clears the directory stack. 4806.RE 4807.TP 8 4808.B echo \fR[ 4809.Fl n\fR] 4810.Va word 4811... 4812Writes each 4813.Va word 4814to the shell's standard 4815output, separated by spaces and terminated with a newline. 4816The 4817.Va echo_style 4818shell variable may be set to emulate (or not) the flags and escape 4819sequences of the BSD and/or System V versions of 4820.Va echo 4821; see 4822.Va echo 4823(1). 4824.TP 8 4825.B echotc \fR[ 4826.Fl sv\fR] 4827.Va arg 4828... (+) 4829Exercises the terminal capabilities (see 4830.Va termcap 4831(5)) in 4832.Va args 4833For example, 'echotc home' sends the cursor to the home position, 4834\&'echotc cm 3 10' sends it to column 3 and row 10, and 4835\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test." 4836in the status line. 4837.RS +8 4838.Pp 4839If 4840.Va arg 4841is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the 4842value of that capability ("yes" or "no" indicating that the terminal does 4843or does not have that capability). 4844One might use this to make the output 4845from a shell script less verbose on slow terminals, or limit command 4846output to the number of lines on the screen: 4847.IP "" 4 4848> set history=\`echotc lines\` 4849.br 4850> @ history\-\- 4851.Pp 4852Termcap strings may contain wildcards which will not echo correctly. 4853One should use double quotes when setting a shell variable to a terminal 4854capability string, as in the following example that places the date in 4855the status line: 4856.IP "" 4 4857> set tosl="\`echotc ts 0\`" 4858.br 4859> set frsl="\`echotc fs\`" 4860.br 4861> echo \-n "$tosl";date; echo \-n "$frsl" 4862.Pp 4863With 4864.Fl s\fR, nonexistent capabilities return the empty string rather 4865than causing an error. 4866With 4867.Fl v\fR, messages are verbose. 4868.RE 4869.Pp 4870.B else 4871.br 4872.B end 4873.br 4874.B endif 4875.PD 0 4876.TP 8 4877.B endsw 4878See the description of the 4879.Va foreach 4880, 4881.Va if 4882, 4883.Va switch 4884, and 4885.Va while 4886statements below. 4887.PD 4888.TP 8 4889.B eval 4890.Va arg 4891... 4892Treats the arguments as input to the 4893shell and executes the resulting command(s) in the context 4894of the current shell. 4895This is usually used to execute commands 4896generated as the result of command or variable substitution, 4897because parsing occurs before these substitutions. 4898See 4899.Va tset 4900(1) for a sample use of 4901.Va eval 4902.TP 8 4903.B exec 4904.Va command 4905Executes the specified command in place of the current shell. 4906.TP 8 4907.B exit \fR[ 4908.Va expr 4909] 4910The shell exits either with the value of the specified 4911.Va expr 4912(an expression, as described under 4913.Va Expressions 4914) 4915or, without 4916.Va expr 4917, with the value 0. 4918.TP 8 4919.B fg \fR[\fB% 4920.Va job 4921...] 4922Brings the specified jobs (or, without arguments, the current job) 4923into the foreground, continuing each if it is stopped. 4924.Va job 4925may be a number, a string, 4926.Sq 4927, 4928.Sq % 4929, 4930.Sq + 4931or 4932.Sq \- 4933as described 4934under 4935.Va Jobs 4936See also the 4937.Va run-fg-editor 4938editor command. 4939.TP 8 4940.B filetest \- 4941.Va op file 4942... (+) 4943Applies 4944.Va op 4945(which is a file inquiry operator as described under 4946.Va File inquiry operators 4947) to each 4948.Va file 4949and returns the results as a 4950space-separated list. 4951.Pp 4952.B foreach \fIname \fB(\fIwordlist\fB) 4953.br 4954\&... 4955.PD 0 4956.TP 8 4957.B end 4958Successively sets the variable 4959.Va name 4960to each member of 4961.Va wordlist 4962and executes the sequence of commands between this command 4963and the matching 4964.Va end 4965(Both 4966.Va foreach 4967and 4968.Va end 4969must appear alone on separate lines.) The builtin command 4970.Va continue 4971may be used to continue the loop prematurely and 4972the builtin command 4973.Va break 4974to terminate it prematurely. 4975When this command is read from the terminal, the loop is read once 4976prompting with 4977.Sq foreach? 4978(or 4979.Va prompt2 4980) before any statements in 4981the loop are executed. 4982If you make a mistake typing in a 4983loop at the terminal you can rub it out. 4984.PD 4985.TP 8 4986.B getspath \fR(+) 4987Prints the system execution path. 4988(TCF only) 4989.TP 8 4990.B getxvers \fR(+) 4991Prints the experimental version prefix. 4992(TCF only) 4993.TP 8 4994.B glob \fIwordlist 4995Like 4996.Va echo 4997, but the 4998.Sq -n 4999parameter is not recognized and words are 5000delimited by null characters in the output. 5001Useful for 5002programs which wish to use the shell to filename expand a list of words. 5003.TP 8 5004.B goto \fIword 5005.Va word 5006is filename and command-substituted to 5007yield a string of the form 5008.Sq label 5009The shell rewinds its 5010input as much as possible, searches for a line of the 5011form 5012.Sq label: 5013, possibly preceded by blanks or tabs, and 5014continues execution after that line. 5015.TP 8 5016.B hashstat 5017Prints a statistics line indicating how effective the 5018internal hash table has been at locating commands (and avoiding 5019.Va exec 5020's). 5021An 5022.Va exec 5023is attempted for each component of the 5024.Va path 5025where the hash function indicates a possible hit, and 5026in each component which does not begin with a 5027.Sq / 5028.IP 5029On machines without 5030.Va vfork 5031(2), prints only the number and size of 5032hash buckets. 5033.Pp 5034.B history \fR[ 5035.Fl hTr\fR] [ 5036.Va n 5037] 5038.br 5039.B history \-S\fR| 5040.Fl L| 5041.Fl M \fR[ 5042.Va filename 5043] (+) 5044.PD 0 5045.TP 8 5046.B history \-c \fR(+) 5047The first form prints the history event list. 5048If 5049.Va n 5050is given only the 5051.Va n 5052most recent events are printed or saved. 5053With 5054.Fl h\fR, the history list is printed without leading numbers. 5055If 5056.Va -T 5057is specified, timestamps are printed also in comment form. 5058(This can be used to 5059produce files suitable for loading with 'history \-L' or 'source \-h'.) 5060With 5061.Fl r\fR, the order of printing is most recent 5062first rather than oldest first. 5063.PD 5064.RS +8 5065.Pp 5066With 5067.Fl S\fR, the second form saves the history list to 5068.Va filename 5069If the first word of the 5070.Va savehist 5071shell variable is set to a 5072number, at most that many lines are saved. 5073If the second word of 5074.Va savehist 5075is set to 5076.Sq merge 5077, the history list is merged with the 5078existing history file instead of replacing it (if there is one) and 5079sorted by time stamp. 5080(+) Merging is intended for an environment like 5081the X Window System 5082with several shells in simultaneous use. 5083If the second word of 5084.Va savehist 5085is 5086.Sq merge 5087and the third word is set to 5088.Sq lock 5089, the history file update 5090will be serialized with other shell sessions that would possibly like 5091to merge history at exactly the same time. 5092.Pp 5093With 5094.Fl L\fR, the shell appends 5095.Va filename 5096, which is presumably a 5097history list saved by the 5098.Fl S\fR option or the 5099.Va savehist 5100mechanism, 5101to the history list. 5102.Fl M\fR is like 5103.Fl L\fR, but the contents of 5104.Va filename 5105are merged 5106into the history list and sorted by timestamp. 5107In either case, 5108.Va histfile 5109is used if 5110.Va filename 5111is not given and 5112.Va ~/.history 5113is used if 5114.Va histfile 5115is unset. 5116`history \-L' is exactly like 'source \-h' except that it does not require a 5117filename. 5118.Pp 5119Note that login shells do the equivalent of 5120.Sq history \-L 5121on startup 5122and, if 5123.Va savehist 5124is set, 5125.Sq history \-S 5126before exiting. 5127Because only 5128.Va ~/.tcshrc 5129is normally sourced before 5130.Va ~/.history 5131, 5132.Va histfile 5133should be set in 5134.Va ~/.tcshrc 5135rather than 5136.Va ~/.login 5137.Pp 5138If 5139.Va histlit 5140is set, the first and second forms print and save the literal 5141(unexpanded) form of the history list. 5142.Pp 5143The last form clears the history list. 5144.RE 5145.TP 8 5146.B hup \fR[ 5147.Va command 5148] \fR(+) 5149With 5150.Va command 5151, runs 5152.Va command 5153such that it will exit on a hangup 5154signal and arranges for the shell to send it a hangup signal when the shell 5155exits. 5156Note that commands may set their own response to hangups, overriding 5157.Va hup 5158Without an argument, causes the non-interactive shell only to 5159exit on a hangup for the remainder of the script. 5160See also 5161.Va Signal handling 5162and the 5163.Va nohup 5164builtin command. 5165.TP 8 5166.B if (\fIexpr\fB) \fIcommand 5167If 5168.Va expr 5169(an expression, as described under 5170.Va Expressions 5171) 5172evaluates true, then 5173.Va command 5174is executed. 5175Variable substitution on 5176.Va command 5177happens early, at the same time it 5178does for the rest of the 5179.Va if 5180command. 5181.Va command 5182must be a simple command, not an alias, a pipeline, a command list 5183or a parenthesized command list, but it may have arguments. 5184Input/output redirection occurs even if 5185.Va expr 5186is 5187false and 5188.Va command 5189is thus 5190.Va not 5191executed; this is a bug. 5192.Pp 5193.B if (\fIexpr\fB) then 5194.br 5195\&... 5196.br 5197.B else if (\fIexpr2\fB) then 5198.br 5199\&... 5200.br 5201.B else 5202.br 5203\&... 5204.PD 0 5205.TP 8 5206.B endif 5207If the specified 5208.Va expr 5209is true then the commands to the 5210first 5211.Va else 5212are executed; otherwise if 5213.Va expr2 5214is true then 5215the commands to the second 5216.Va else 5217are executed, etc. 5218Any 5219number of 5220.Va else-if 5221pairs are possible; only one 5222.Va endif 5223is 5224needed. 5225The 5226.Va else 5227part is likewise optional. 5228(The words 5229.Va else 5230and 5231.Va endif 5232must appear at the beginning of input lines; 5233the 5234.Va if 5235must appear alone on its input line or after an 5236.Va else 5237.) 5238.PD 5239.TP 8 5240.B inlib 5241.Va shared-library 5242... (+) 5243Adds each 5244.Va shared-library 5245to the current environment. 5246There is no way 5247to remove a shared library. 5248(Domain/OS only) 5249.TP 8 5250.B jobs \fR[ 5251.Fl l\fR] 5252Lists the active jobs. 5253With 5254.Fl l\fR, lists process 5255IDs in addition to the normal information. 5256On TCF systems, prints 5257the site on which each job is executing. 5258.Pp 5259.PD 0 5260.TP 8 5261.B kill \fR[ 5262.Fl s 5263.Va signal 5264] \fB% 5265.Va job 5266| 5267.Va pid 5268... 5269.PD 0 5270.TP 8 5271.B kill \-l 5272The first and second forms sends the specified 5273.Va signal 5274(or, if none 5275is given, the TERM (terminate) signal) to the specified jobs or processes. 5276.Va job 5277may be a number, a string, 5278.Sq 5279, 5280.Sq % 5281, 5282.Sq + 5283or 5284.Sq \- 5285as described 5286under 5287.Va Jobs 5288Signals are either given by number or by name (as given in 5289.Va /usr/include/signal.h 5290, stripped of the prefix 5291.Sq SIG 5292). 5293There is no default 5294.Va job 5295; saying just 5296.Sq kill 5297does not send a signal 5298to the current job. 5299If the signal being sent is TERM (terminate) 5300or HUP (hangup), then the job or process is sent a 5301CONT (continue) signal as well. 5302The third form lists the signal names. 5303.PD 5304.TP 8 5305.B limit \fR[ 5306.Fl h\fR] [ 5307.Va resource 5308[ 5309.Va maximum-use 5310]] 5311Limits the consumption by the current process and each 5312process it creates to not individually exceed 5313.Va maximum-use 5314on 5315the specified 5316.Va resource 5317If no 5318.Va maximum-use 5319is given, then 5320the current limit is printed; if no 5321.Va resource 5322is given, then 5323all limitations are given. 5324If the 5325.Fl h\fR flag is given, the 5326hard limits are used instead of the current limits. 5327The 5328hard limits impose a ceiling on the values of the current 5329limits. 5330Only the super-user may raise the hard limits, but 5331a user may lower or raise the current limits within the legal range. 5332.Pp 5333Controllable resources currently include (if supported by the OS): 5334.Bl -tag -width pseudoterminals -compact -offset indent 5335.It Va cputime 5336the maximum number of cpu-seconds to be used by each process 5337.It Va filesize 5338the largest single file which can be created 5339.It Va datasize 5340the maximum growth of the data+stack region via sbrk(2) beyond 5341the end of the program text 5342.It Va stacksize 5343the maximum size of the automatically-extended stack region 5344.It Va coredumpsize 5345the size of the largest core dump that will be created 5346.It Va memoryuse 5347the maximum amount of physical memory a process 5348may have allocated to it at a given time 5349.It Va vmemoryuse 5350the maximum amount of virtual memory a process 5351may have allocated to it at a given time (address space) 5352.It Va vmemoryuse 5353the maximum amount of virtual memory a process 5354may have allocated to it at a given time 5355.It Va heapsize 5356the maximum amount of memory a process 5357may allocate per 5358.Xr brk 2 5359system call 5360.It Va descriptors 5361or 5362.It Va openfiles 5363the maximum number of open files for this process 5364.It Va pseudoterminals 5365the maximum number of pseudo-terminals for this user 5366.It Va kqueues 5367the maximum number of kqueues allocated for this process 5368.It Va concurrency 5369the maximum number of threads for this process 5370.It Va memorylocked 5371the maximum size which a process may lock into memory using mlock(2) 5372.It Va maxproc 5373the maximum number of simultaneous processes for this user id 5374.It Va maxthread 5375the maximum number of simultaneous threads (lightweight processes) for this 5376user id 5377.It Va threads 5378the maximum number of threads for this process 5379.It Va sbsize 5380the maximum size of socket buffer usage for this user 5381.It Va swapsize 5382the maximum amount of swap space reserved or used for this user 5383.It Va maxlocks 5384the maximum number of locks for this user 5385.It Va posixlocks 5386the maximum number of POSIX advisory locks for this user 5387.It Va maxsignal 5388the maximum number of pending signals for this user 5389.It Va maxmessage 5390the maximum number of bytes in POSIX mqueues for this user 5391.It Va maxnice 5392the maximum nice priority the user is allowed to raise mapped from [19...-20] 5393to [0...39] for this user 5394.It Va maxrtprio 5395the maximum realtime priority for this user 5396.It Va maxrttime 5397the timeout for RT tasks in microseconds for this user. 5398.El 5399.Pp 5400.Va maximum-use 5401may be given as a (floating point or 5402integer) number followed by a scale factor. 5403For all limits 5404other than 5405.Va cputime 5406the default scale is 5407.Sq k 5408or 5409.Sq kilobytes 5410(1024 bytes); a scale factor of 5411.Sq m 5412or 5413.Sq megabytes 5414or 5415.Sq g 5416or 5417.Sq gigabytes 5418may also be used. 5419For 5420.Va cputime 5421the default scaling is 5422.Sq seconds , 5423while 5424.Sq m 5425for minutes or 5426.Sq h 5427for hours, or a time of the 5428form 5429.Sq mm:ss 5430giving minutes and seconds may be used. 5431.Pp 5432If 5433.Va maximum-use 5434is 5435.Sq unlimited , 5436then the limitation on the specified 5437.Va resource 5438is removed (this is equivalent to the 5439.Va unlimit 5440builtin command). 5441.Pp 5442For both 5443.Va resource 5444names and scale factors, unambiguous 5445prefixes of the names suffice. 5446.RE 5447.TP 8 5448.B log \fR(+) 5449Prints the 5450.Va watch 5451shell variable and reports on each user indicated 5452in 5453.Va watch 5454who is logged in, regardless of when they last logged in. 5455See also 5456.Va watchlog 5457.TP 8 5458.B login 5459Terminates a login shell, replacing it with an instance of 5460.Va /bin/login 5461. This is one way to log off, included for 5462compatibility with 5463.Xr sh 1 . 5464.TP 8 5465.B logout 5466Terminates a login shell. 5467Especially useful if 5468.Va ignoreeof 5469is set. 5470.TP 8 5471.B ls\-F \fR[\- 5472.Va switch 5473...] [ 5474.Va file 5475...] (+) 5476Lists files like 5477.Sq ls \-F 5478, but much faster. 5479It identifies each type of 5480special file in the listing with a special character: 5481.Bl -tag -width x -offset indent -compact 5482.It Dv / 5483Directory 5484.It Dv * 5485Executable 5486.It Dv # 5487Block device 5488.It Dv % 5489Character device 5490.It Dv | 5491Named pipe (systems with named pipes only) 5492.It Dv = 5493Socket (systems with sockets only) 5494.It Dv @ 5495Symbolic link (systems with symbolic links only) 5496.It Dv + 5497Hidden directory (AIX only) or context dependent (HP/UX only) 5498.It Dv : 5499Network special (HP/UX only) 5500.El 5501.Pp 5502If the 5503.Va listlinks 5504shell variable is set, symbolic links are identified 5505in more detail (on only systems that have them, of course): 5506.Pp 5507.PD 0 5508.TP 4 5509@ 5510Symbolic link to a non-directory 5511.TP 4 5512> 5513Symbolic link to a directory 5514.TP 4 5515& 5516Symbolic link to nowhere 5517.PD 5518.Pp 5519.Va listlinks 5520also slows down \fIls\-F\fR and causes partitions holding 5521files pointed to by symbolic links to be mounted. 5522.Pp 5523If the 5524.Va listflags 5525shell variable is set to 5526.Sq x 5527, 5528.Sq a 5529or 5530.Sq A 5531, or any 5532combination thereof (e.g., 5533.Sq xA 5534), they are used as flags to \fIls\-F\fR, 5535making it act like 5536.Sq ls \-xF 5537, 5538.Sq ls \-Fa 5539, 5540.Sq ls \-FA 5541or a combination 5542(e.g., 5543.Sq ls \-FxA 5544). 5545On machines where 5546.Sq ls \-C 5547is not the default, \fIls\-F\fR acts like 5548.Sq ls \-CF 5549, 5550unless 5551.Va listflags 5552contains an 5553.Sq x 5554, in which case it acts like 5555.Sq ls \-xF 5556\fIls\-F\fR passes its arguments to 5557.Va ls 5558(1) if it is given any switches, 5559so 5560.Sq alias ls ls\-F 5561generally does the right thing. 5562.Pp 5563The \fBls\-F\fR builtin can list files using different colors depending on the 5564filetype or extension. 5565See the 5566.Va color 5567shell variable and the 5568.Va LS_COLORS 5569environment variable. 5570.RE 5571.Pp 5572.B migrate \fR[ 5573.Fl 5574.Va site 5575] 5576.Va pid 5577|\fB% 5578.Va jobid 5579... (+) 5580.PD 0 5581.TP 8 5582.B migrate \- 5583.Va site 5584(+) 5585The first form migrates the process or job to the site specified or the 5586default site determined by the system path. 5587The second form is equivalent to 5588.Sq migrate \- 5589.Va site 5590$$ 5591: it migrates the 5592current process to the specified site. 5593Migrating the shell 5594itself can cause unexpected behavior, because the shell 5595does not like to lose its tty. 5596(TCF only) 5597.PD 5598.TP 8 5599.B newgrp \fR[ 5600.Fl \fR] 5601.Va [group] 5602(+) 5603Equivalent to 5604.Sq exec newgrp 5605; see 5606.Va newgrp 5607(1). 5608Available only if the shell was so compiled; 5609see the 5610.Va version 5611shell variable. 5612.TP 8 5613.B nice \fR[\fB+ 5614.Va number 5615] [ 5616.Va command 5617] 5618Sets the scheduling priority for the shell to 5619.Va number 5620, or, without 5621.Va number 5622, to 4. 5623With 5624.Va command , 5625runs 5626.Va command 5627at the appropriate 5628priority. 5629The greater the 5630.Va number 5631, the less cpu 5632the process gets. 5633The super-user may specify negative 5634priority by using 5635.Sq nice \-number ... 5636Command is always 5637executed in a sub-shell, and the restrictions placed on 5638commands in simple 5639.Va if 5640statements apply. 5641.TP 8 5642.B nohup \fR[ 5643.Va command 5644] 5645With 5646.Va command 5647, runs 5648.Va command 5649such that it will ignore hangup signals. 5650Note that commands may set their own response to hangups, overriding 5651.Va nohup 5652Without an argument, causes the non-interactive shell only to 5653ignore hangups for the remainder of the script. 5654See also 5655.Va Signal handling 5656and the 5657.Va hup 5658builtin command. 5659.TP 8 5660.B notify \fR[\fB% 5661.Va job 5662...] 5663Causes the shell to notify the user asynchronously when the status of any 5664of the specified jobs (or, without % 5665.Va job 5666, the current job) changes, 5667instead of waiting until the next prompt as is usual. 5668.Va job 5669may be a number, a string, 5670.Sq 5671, 5672.Sq % 5673, 5674.Sq + 5675or 5676.Sq \- 5677as described 5678under 5679.Va Jobs 5680See also the 5681.Va notify 5682shell variable. 5683.TP 8 5684.B onintr \fR[ 5685.Fl \fR| 5686.Va label 5687] 5688Controls the action of the shell on interrupts. 5689Without arguments, 5690restores the default action of the shell on interrupts, 5691which is to terminate shell scripts or to return to the 5692terminal command input level. 5693With 5694.Sq \- 5695, causes all interrupts to be ignored. 5696With 5697.Va label 5698, causes the shell to execute a 5699.Sq goto 5700.Va label 5701when an interrupt is received or a child process terminates because it was 5702interrupted. 5703.IP "" 8 5704.Va onintr 5705is ignored if the shell is running detached and in system 5706startup files (see 5707.Va FILES 5708), where interrupts are disabled anyway. 5709.TP 8 5710.B popd \fR[ 5711.Fl p\fR] [ 5712.Fl l\fR] [ 5713.Fl n\fR| 5714.Fl v\fR] \fR[\fB+ 5715.Va n 5716] 5717Without arguments, pops the directory stack and returns to the new top directory. 5718With a number 5719.Sq + 5720.Va n 5721, discards the 5722.Va n 5723'th entry in the stack. 5724.IP "" 8 5725Finally, all forms of 5726.Va popd 5727print the final directory stack, 5728just like 5729.Va dirs 5730The 5731.Va pushdsilent 5732shell variable can be set to 5733prevent this and the 5734.Fl p\fR flag can be given to override 5735.Va pushdsilent 5736The 5737.Fl l\fR, 5738.Fl n\fR and 5739.Fl v\fR flags have the same effect on 5740.Va popd 5741as on 5742.Va dirs 5743(+) 5744.TP 8 5745.B printenv \fR[ 5746.Va name 5747] (+) 5748Prints the names and values of all environment variables or, 5749with 5750.Va name 5751, the value of the environment variable 5752.Va name 5753.TP 8 5754.B pushd \fR[ 5755.Fl p\fR] [ 5756.Fl l\fR] [ 5757.Fl n\fR| 5758.Fl v\fR] [ 5759.Va name 5760|\fB+ 5761.Va n 5762] 5763Without arguments, exchanges the top two elements of the directory stack. 5764If 5765.Va pushdtohome 5766is set, 5767.Va pushd 5768without arguments does 5769.Sq pushd ~ 5770, 5771like 5772.Va cd 5773(+) 5774With 5775.Va name 5776, pushes the current working directory onto the directory 5777stack and changes to 5778.Va name 5779If 5780.Va name 5781is 5782.Sq \- 5783it is interpreted as the previous working directory 5784(see 5785.Va Filename substitution 5786). 5787(+) 5788If 5789.Va dunique 5790is set, 5791.Va pushd 5792removes any instances of 5793.Va name 5794from the stack before pushing it onto the stack. 5795(+) 5796With a number 5797.Sq + 5798.Va n 5799, rotates the 5800.Va n 5801th element of the 5802directory stack around to be the top element and changes to it. 5803If 5804.Va dextract 5805is set, however, 5806.Sq pushd + 5807.Va n 5808extracts the 5809.Va n 5810th 5811directory, pushes it onto the top of the stack and changes to it. 5812(+) 5813.IP "" 8 5814Finally, all forms of 5815.Va pushd 5816print the final directory stack, 5817just like 5818.Va dirs 5819The 5820.Va pushdsilent 5821shell variable can be set to 5822prevent this and the 5823.Fl p\fR flag can be given to override 5824.Va pushdsilent 5825The 5826.Fl l\fR, 5827.Fl n\fR and 5828.Fl v\fR flags have the same effect on 5829.Va pushd 5830as on 5831.Va dirs 5832(+) 5833.TP 8 5834.B rehash 5835Causes the internal hash table of the contents of the 5836directories in the 5837.Va path 5838variable to be recomputed. 5839This is 5840needed if the 5841.Va autorehash 5842shell variable is not set and new 5843commands are added to directories in 5844.Va path 5845while you are logged 5846in. 5847With 5848.Va autorehash 5849, a new command will be found 5850automatically, except in the special case where another command of 5851the same name which is located in a different directory already 5852exists in the hash table. 5853Also flushes the cache of home directories 5854built by tilde expansion. 5855.TP 8 5856.B repeat \fIcount command 5857The specified 5858.Va command 5859, 5860which is subject to the same restrictions as the 5861.Va command 5862in the one line 5863.Va if 5864statement above, is executed 5865.Va count 5866times. 5867I/O redirections occur exactly once, even if 5868.Va count 5869is 0. 5870.TP 8 5871.B rootnode // 5872.Va nodename 5873(+) 5874Changes the rootnode to // 5875.Va nodename 5876, so that 5877.Sq / 5878will be interpreted 5879as 5880.Sq // 5881.Va nodename 5882(Domain/OS only) 5883.Pp 5884.B sched \fR(+) 5885.br 5886.B sched \fR[ 5887.Va + 5888] 5889.Va hh:mm command 5890\fR(+) 5891.PD 0 5892.TP 8 5893.B sched \- 5894.Va n 5895(+) 5896The first form prints the scheduled-event list. 5897The 5898.Va sched 5899shell variable may be set to define the format in which 5900the scheduled-event list is printed. 5901The second form adds 5902.Va command 5903to the scheduled-event list. 5904For example, 5905.PD 5906.RS +8 5907.IP "" 4 5908> sched 11:00 echo It\e's eleven o\e'clock. 5909.Pp 5910causes the shell to echo 5911.Sq It's eleven o'clock . 5912at 11 AM. 5913The time may be in 12-hour AM/PM format 5914.IP "" 4 5915.\" TODO 5916> sched 5pm set prompt='[%h] It\e's after 5; go home: >' 5917.Pp 5918or may be relative to the current time: 5919.IP "" 4 5920> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother 5921.Pp 5922A relative time specification may not use AM/PM format. 5923The third form removes item 5924.Va n 5925from the event list: 5926.Bd -literal -offset indent 5927> sched 5928 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother 5929 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: > 5930> sched \-2 5931> sched 5932 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother 5933.Ed 5934.Pp 5935A command in the scheduled-event list is executed just before the first 5936prompt is printed after the time when the command is scheduled. 5937It is possible to miss the exact time when the command is to be run, but 5938an overdue command will execute at the next prompt. 5939A command which comes due while the shell 5940is waiting for user input is executed immediately. 5941However, normal operation of an already-running command will not 5942be interrupted so that a scheduled-event list element may be run. 5943.Pp 5944This mechanism is similar to, but not the same as, the 5945.Va at 5946(1) 5947command on some Unix systems. 5948Its major disadvantage is that it may not run a command at exactly the 5949specified time. 5950Its major advantage is that because 5951.Va sched 5952runs directly from 5953the shell, it has access to shell variables and other structures. 5954This provides a mechanism for changing one's working environment 5955based on the time of day. 5956.RE 5957.Pp 5958.B set 5959.br 5960.B set 5961.Va name 5962... 5963.br 5964.B set 5965.Va name 5966\fB= 5967.Va word 5968... 5969.br 5970.B set [\-r] [\-f|\-l] 5971.Va name 5972\fB=(\fIwordlist 5973.Va ) 5974... (+) 5975.br 5976.B set 5977.Va name[index] 5978\fB= 5979.Va word 5980... 5981.br 5982.B set \-r \fR(+) 5983.br 5984.B set \-r 5985.Va name 5986... (+) 5987.PD 0 5988.TP 8 5989.B set \-r 5990.Va name 5991\fB= 5992.Va word 5993... (+) 5994The first form of the command prints the value of all shell variables. 5995Variables which contain more than a single word print as a 5996parenthesized word list. 5997The second form sets 5998.Va name 5999to the null string. 6000The third form sets 6001.Va name 6002to the single 6003.Va word 6004The fourth form sets 6005.Va name 6006to the list of words in 6007.Va wordlist 6008In all cases the value is command and filename expanded. 6009If 6010.Fl r\fR is specified, the value is set read-only. 6011If 6012.Fl f\fR or 6013.Fl l\fR are specified, set only unique words keeping their order. 6014.Fl f\fR prefers the first occurrence of a word, and 6015.Fl l\fR the last. 6016The fifth form sets the 6017.Va index 6018'th component of 6019.Va name 6020to 6021.Va word 6022; 6023this component must already exist. 6024The sixth form lists only the names of all shell variables that are read-only. 6025The seventh form makes 6026.Va name 6027read-only, whether or not it has a value. 6028The eighth form is the same as the third form, but 6029make 6030.Va name 6031read-only at the same time. 6032.PD 6033.IP "" 8 6034These arguments can be repeated to set and/or make read-only multiple variables 6035in a single set command. 6036Note, however, that variable expansion 6037happens for all arguments before any setting occurs. 6038Note also that 6039.Sq = 6040can 6041be adjacent to both 6042.Va name 6043and 6044.Va word 6045or separated from both by 6046whitespace, but cannot be adjacent to only one or the other. 6047See also the 6048.Va unset 6049builtin command. 6050.TP 8 6051.B setenv \fR[ 6052.Va name 6053[ 6054.Va value 6055]] 6056Without arguments, prints the names and values of all environment variables. 6057Given 6058.Va name 6059, sets the environment variable 6060.Va name 6061to 6062.Va value 6063or, without 6064.Va value 6065, to the null string. 6066.TP 8 6067.B setpath 6068.Va path 6069(+) 6070Equivalent to 6071.Va setpath 6072(1). 6073(Mach only) 6074.TP 8 6075.B setspath\fR LOCAL| 6076.Va site 6077| 6078.Va cpu 6079... 6080(+) 6081Sets the system execution path. 6082(TCF only) 6083.TP 8 6084.B settc 6085.Va cap value 6086(+) 6087Tells the shell to believe that the terminal capability 6088.Va cap 6089(as defined in 6090.Va termcap 6091(5)) has the value 6092.Va value 6093No sanity checking is done. 6094Concept terminal users may have to 6095.Sq settc xn no 6096to get proper 6097wrapping at the rightmost column. 6098.TP 8 6099.B setty \fR[ 6100.Fl d\fR| 6101.Fl q\fR| 6102.Fl x\fR] [ 6103.Fl a\fR] [[ 6104.Va + 6105| 6106.Fl \fR] 6107.Va mode 6108] (+) 6109Controls which tty modes (see 6110.Va Terminal management 6111) 6112the shell does not allow to change. 6113.Fl d\fR, 6114.Fl q\fR or 6115.Fl x\fR tells 6116.Va setty 6117to act 6118on the 6119.Sq edit 6120, 6121.Sq quote 6122or 6123.Sq execute 6124set of tty modes respectively; without 6125.Fl d\fR, 6126.Fl q\fR or 6127.Fl x\fR, 6128.Sq execute 6129is used. 6130.IP "" 8 6131Without other arguments, 6132.Va setty 6133lists the modes in the chosen set 6134which are fixed on (`+mode') or off (`\-mode'). 6135The available modes, and thus the display, vary from system to system. 6136With 6137.Fl a\fR, lists all tty modes in the chosen set 6138whether or not they are fixed. 6139With \fB+ 6140.Va mode 6141, 6142.Fl 6143.Va mode 6144or 6145.Va mode 6146, fixes 6147.Va mode 6148on or off 6149or removes control from 6150.Va mode 6151in the chosen set. 6152For example, 6153.Sq setty +echok echoe 6154fixes 6155.Sq echok 6156mode on and allows commands 6157to turn 6158.Sq echoe 6159mode on or off, both when the shell is executing commands. 6160.TP 8 6161.B setxvers\fR [ 6162.Va string 6163] (+) 6164Set the experimental version prefix to 6165.Va string 6166, or removes it 6167if 6168.Va string 6169is omitted. 6170(TCF only) 6171.TP 8 6172.B shift \fR[ 6173.Va variable 6174] 6175Without arguments, discards 6176.Va argv 6177[1] and shifts the members of 6178.Va argv 6179to the left. 6180It is an error for 6181.Va argv 6182not to be set or to have 6183less than one word as value. 6184With 6185.Va variable 6186, performs the 6187same function on 6188.Va variable 6189.TP 8 6190.B source \fR[ 6191.Fl h\fR] 6192.Va name 6193[ 6194.Va args 6195...] 6196The shell reads and executes commands from 6197.Va name 6198The commands are not placed on the history list. 6199If any 6200.Va args 6201are given, they are placed in 6202.Va argv 6203(+) 6204.Va source 6205commands may be nested; 6206if they are nested too deeply the shell may run out of file descriptors. 6207An error in a 6208.Va source 6209at any level terminates all nested 6210.Va source 6211commands. 6212With 6213.Fl h\fR, commands are placed on the history list instead of being 6214executed, much like 6215.Sq history \-L 6216.TP 8 6217.B stop \fB% 6218.Va job 6219| 6220.Va pid 6221... 6222Stops the specified jobs or processes which are executing in the background. 6223.Va job 6224may be a number, a string, 6225.Sq 6226, 6227.Sq % 6228, 6229.Sq + 6230or 6231.Sq \- 6232as described 6233under 6234.Va Jobs 6235There is no default 6236.Va job 6237; saying just 6238.Sq stop 6239does not stop 6240the current job. 6241.TP 8 6242.B suspend 6243Causes the shell to stop in its tracks, much as if it had 6244been sent a stop signal with 6245.Va ^Z 6246This is most often used to 6247stop shells started by 6248.Va su 6249(1). 6250.Pp 6251.B switch (\fIstring\fB) 6252.br 6253.B case \fIstr1\fB: 6254.PD 0 6255.IP "" 4 6256\&... 6257.br 6258.B breaksw 6259.Pp 6260\&... 6261.Pp 6262.B default: 6263.IP "" 4 6264\&... 6265.br 6266.B breaksw 6267.TP 8 6268.B endsw 6269Each case label is successively matched, against the 6270specified 6271.Va string 6272which is first command and filename expanded. 6273The file metacharacters 6274.Sq * 6275, 6276.Sq \&? 6277and 6278.Sq [...] 6279may be used 6280in the case labels, which are variable expanded. 6281If none 6282of the labels match before a 6283.Sq default 6284label is found, then 6285the execution begins after the default label. 6286Each case 6287label and the default label must appear at the beginning of 6288a line. 6289The command 6290.Va breaksw 6291causes execution to continue 6292after the 6293.Va endsw 6294Otherwise control may fall through case 6295labels and default labels as in C. 6296If no label matches and 6297there is no default, execution continues after the 6298.Va endsw 6299.PD 6300.TP 8 6301.B telltc \fR(+) 6302Lists the values of all terminal capabilities (see 6303.Va termcap 6304(5)). 6305.TP 8 6306.B termname \fR[ 6307.Va terminal type 6308] \fR(+) 6309Tests if 6310.Va terminal type 6311(or the current value of 6312.Va TERM 6313if no 6314.Va terminal type 6315is given) has an entry in the hosts termcap(5) or 6316terminfo(5) database. Prints the terminal type to stdout and returns 0 6317if an entry is present otherwise returns 1. 6318.TP 8 6319.B time \fR[ 6320.Va command 6321] 6322Executes 6323.Va command 6324(which must be a simple command, not an alias, 6325a pipeline, a command list or a parenthesized command list) 6326and prints a time summary as described under the 6327.Va time 6328variable. 6329If necessary, an extra shell is created to print the time statistic when 6330the command completes. 6331Without 6332.Va command 6333, prints a time summary for the current shell and its 6334children. 6335.TP 8 6336.B umask \fR[ 6337.Va value 6338] 6339Sets the file creation mask to 6340.Va value 6341, which is given in octal. 6342Common values for the mask are 6343002, giving all access to the group and read and execute access to others, and 6344022, giving read and execute access to the group and others. 6345Without 6346.Va value 6347, prints the current file creation mask. 6348.TP 8 6349.B unalias 6350.Va pattern 6351.br 6352Removes all aliases whose names match 6353.Va pattern 6354`unalias *' thus removes all aliases. 6355It is not an error for nothing to be 6356.Va unalias 6357ed. 6358.TP 8 6359.B uncomplete 6360.Va pattern 6361(+) 6362Removes all completions whose names match 6363.Va pattern 6364`uncomplete *' thus removes all completions. 6365It is not an error for nothing to be 6366.Va uncomplete 6367d. 6368.TP 8 6369.B unhash 6370Disables use of the internal hash table to speed location of 6371executed programs. 6372.TP 8 6373.B universe 6374.Va universe 6375(+) 6376Sets the universe to 6377.Va universe 6378(Masscomp/RTU only) 6379.TP 8 6380.B unlimit \fR[ 6381.Fl hf\fR] [ 6382.Va resource 6383] 6384Removes the limitation on 6385.Va resource 6386or, if no 6387.Va resource 6388is 6389specified, all 6390.Va resource 6391limitations. 6392With 6393.Fl h\fR, the corresponding hard limits are removed. 6394Only the super-user may do this. 6395Note that 6396.Va unlimit 6397may not exit successful, since most systems 6398do not allow 6399.Va descriptors 6400to be unlimited. 6401With 6402.Fl f\fR errors are ignored. 6403.TP 8 6404.B unset \fIpattern 6405Removes all variables whose names match 6406.Va pattern 6407, unless they are read-only. 6408`unset *' thus removes all variables unless they are read-only; 6409this is a bad idea. 6410It is not an error for nothing to be 6411.Va unset 6412.TP 8 6413.B unsetenv \fIpattern 6414Removes all environment variables whose names match 6415.Va pattern 6416`unsetenv *' thus removes all environment variables; 6417this is a bad idea. 6418It is not an error for nothing to be 6419.Va unsetenv 6420ed. 6421.TP 8 6422.B ver \fR[ 6423.Va systype 6424[ 6425.Va command 6426]] (+) 6427Without arguments, prints 6428.Va SYSTYPE 6429With 6430.Va systype 6431, sets 6432.Va SYSTYPE 6433to 6434.Va systype 6435With 6436.Va systype 6437and 6438.Va command 6439, executes 6440.Va command 6441under 6442.Va systype 6443.Va systype 6444may be 6445.Sq bsd4.3 6446or 6447.Sq sys5.3 6448(Domain/OS only) 6449.TP 8 6450.B wait 6451The shell waits for all background jobs. 6452If the shell is interactive, an 6453interrupt will disrupt the wait and cause the shell to print the names and job 6454numbers of all outstanding jobs. 6455.TP 8 6456.B warp 6457.Va universe 6458(+) 6459Sets the universe to 6460.Va universe 6461(Convex/OS only) 6462.TP 8 6463.B watchlog \fR(+) 6464An alternate name for the 6465.Va log 6466builtin command (q.v.). 6467Available only if the shell was so compiled; 6468see the 6469.Va version 6470shell variable. 6471.TP 8 6472.B where 6473.Va command 6474(+) 6475Reports all known instances of 6476.Va command 6477, including aliases, builtins and 6478executables in 6479.Va path 6480.TP 8 6481.B which\fR 6482.Va command 6483(+) 6484Displays the command that will be executed by the shell after substitutions, 6485.Va path 6486searching, etc. 6487The builtin command is just like 6488.Va which 6489(1), but it correctly reports 6490.Nm 6491aliases and builtins and is 10 to 100 times faster. 6492See also the 6493.Va which-command 6494editor command. 6495.Pp 6496.B while (\fIexpr 6497.Va ) 6498.br 6499\&... 6500.PD 0 6501.TP 8 6502.B end 6503Executes the commands between the 6504.Va while 6505and the matching 6506.Va end 6507while 6508.Va expr 6509(an expression, as described under 6510.Va Expressions 6511) 6512evaluates non-zero. 6513.Va while 6514and 6515.Va end 6516must appear alone on their input lines. 6517.Va break 6518and 6519.Va continue 6520may be used to terminate or continue the 6521loop prematurely. 6522If the input is a terminal, the user is prompted the first time 6523through the loop as with 6524.Va foreach 6525.PD 6526.Ss "Special aliases (+)" 6527If set, each of these aliases executes automatically at the indicated time. 6528They are all initially undefined. 6529.TP 8 6530.B beepcmd 6531Runs when the shell wants to ring the terminal bell. 6532.TP 8 6533.B cwdcmd 6534Runs after every change of working directory. 6535For example, if the user is 6536working on an X window system using 6537.Va xterm 6538(1) and a re-parenting window 6539manager that supports title bars such as 6540.Va twm 6541(1) and does 6542.RS +8 6543.IP "" 4 6544> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd ^G"' 6545.Pp 6546then the shell will change the title of the running 6547.Va xterm 6548(1) 6549to be the name of the host, a colon, and the full current working directory. 6550A fancier way to do that is 6551.IP "" 4 6552> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"' 6553.Pp 6554This will put the hostname and working directory on the title bar but 6555only the hostname in the icon manager menu. 6556.Pp 6557Note that putting a 6558.Va cd 6559, 6560.Va pushd 6561or 6562.Va popd 6563in 6564.Va cwdcmd 6565may cause an infinite loop. 6566It is the author's opinion that anyone doing 6567so will get what they deserve. 6568.RE 6569.TP 8 6570.B jobcmd 6571Runs before each command gets executed, or when the command changes state. 6572This is similar to 6573.Va postcmd 6574, but it does not print builtins. 6575.RS +8 6576.IP "" 4 6577> alias jobcmd 'echo \-n "^[]2\e;\e!#:q^G"' 6578.Pp 6579then executing 6580.Va vi foo.c 6581will put the command string in the xterm title bar. 6582.RE 6583.TP 8 6584.B helpcommand 6585Invoked by the 6586.Va run-help 6587editor command. 6588The command name for which help 6589is sought is passed as sole argument. 6590For example, if one does 6591.RS +8 6592.IP "" 4 6593> alias helpcommand '\e!:1 --help' 6594.Pp 6595then the help display of the command itself will be invoked, using the GNU 6596help calling convention. 6597Currently there is no easy way to account for various calling conventions (e.g., 6598the customary Unix 6599.Sq -h 6600), except by using a table of many commands. 6601.RE 6602.TP 8 6603.B periodic 6604Runs every 6605.Va tperiod 6606minutes. 6607This provides a convenient means for 6608checking on common but infrequent changes such as new mail. 6609For example, 6610if one does 6611.RS +8 6612.IP "" 4 6613> set tperiod = 30 6614.br 6615> alias periodic checknews 6616.Pp 6617then the 6618.Va checknews 6619(1) program runs every 30 minutes. 6620If 6621.Va periodic 6622is set but 6623.Va tperiod 6624is unset or set to 0, 6625.Va periodic 6626behaves like 6627.Va precmd 6628.RE 6629.TP 8 6630.B precmd 6631Runs just before each prompt is printed. 6632For example, if one does 6633.RS +8 6634.IP "" 4 6635> alias precmd date 6636.Pp 6637then 6638.Va date 6639(1) runs just before the shell prompts for each command. 6640There are no limits on what 6641.Va precmd 6642can be set to do, but discretion 6643should be used. 6644.RE 6645.TP 8 6646.B postcmd 6647Runs before each command gets executed. 6648.RS +8 6649.IP "" 4 6650> alias postcmd 'echo \-n "^[]2\e;\e!#:q^G"' 6651.Pp 6652then executing 6653.Va vi foo.c 6654will put the command string in the xterm title bar. 6655.RE 6656.TP 8 6657.B shell 6658Specifies the interpreter for executable scripts which do not themselves 6659specify an interpreter. 6660The first word should be a full path name to the 6661desired interpreter (e.g., 6662.Sq /bin/csh 6663or 6664.Sq /usr/local/bin/tcsh 6665). 6666.Ss "Special shell variables" 6667The variables described in this section have special meaning to the shell. 6668.Pp 6669The shell sets 6670.Va addsuffix , 6671.Va argv , 6672.Va autologout , 6673.Va csubstnonl , 6674.Va command , 6675.Va echo_style , 6676.Va edit , 6677.Va gid , 6678.Va group , 6679.Va home , 6680.Va loginsh , 6681.Va oid , 6682.Va path , 6683.Va prompt , 6684.Va prompt2 , 6685.Va prompt3 , 6686.Va shell , 6687.Va shlvl , 6688.Va tcsh , 6689.Va term , 6690.Va tty , 6691.Va uid , 6692.Va user 6693and 6694.Va version 6695at 6696startup; they do not change thereafter unless changed by the user. 6697The shell updates 6698.Va cwd , 6699.Va dirstack , 6700.Va owd 6701and 6702.Va status 6703when necessary, 6704and sets 6705.Va logout 6706on logout. 6707.Pp 6708The shell synchronizes 6709.Va group , 6710.Va home , 6711.Va path , 6712.Va shlvl , 6713.Va term and 6714.Va user 6715with the environment variables of the same names: 6716whenever the environment variable changes the shell changes the corresponding 6717shell variable to match (unless the shell variable is read-only) and vice 6718versa. 6719Note that although 6720.Va cwd 6721and 6722.Va PWD 6723have identical meanings, they 6724are not synchronized in this manner, and that the shell automatically 6725converts between the different formats of 6726.Va path 6727and 6728.Va PATH 6729.TP 8 6730.B addsuffix \fR(+) 6731If set, filename completion adds 6732.Sq / 6733to the end of directories and a space 6734to the end of normal files when they are matched exactly. 6735Set by default. 6736.TP 8 6737.B afsuser \fR(+) 6738If set, 6739.Va autologout 6740's autolock feature uses its value instead of 6741the local username for kerberos authentication. 6742.TP 8 6743.B ampm \fR(+) 6744If set, all times are shown in 12-hour AM/PM format. 6745.TP 8 6746.B anyerror \fR(+) 6747This variable selects what is propagated to the value of the 6748.Va status 6749variable. For more information see the description of the 6750.Va status 6751variable below. 6752.TP 8 6753.B argv 6754The arguments to the shell. 6755Positional parameters are taken from 6756.Va argv 6757, 6758i.e., 6759.Sq $1 6760is replaced by 6761.Sq $argv[1] 6762, etc. 6763Set by default, but usually empty in interactive shells. 6764.TP 8 6765.B autocorrect \fR(+) 6766If set, the 6767.Va spell-word 6768editor command is invoked automatically before 6769each completion attempt. 6770.TP 8 6771.B autoexpand \fR(+) 6772If set, the 6773.Va expand-history 6774editor command is invoked automatically 6775before each completion attempt. If this is set to 6776.Va onlyhistory 6777, then 6778only history will be expanded and a second completion will expand filenames. 6779.TP 8 6780.B autolist \fR(+) 6781If set, possibilities are listed after an ambiguous completion. 6782If set to 6783.Sq ambiguous 6784, possibilities are listed only when no new 6785characters are added by completion. 6786.TP 8 6787.B autologout \fR(+) 6788The first word is the number of minutes of inactivity before automatic 6789logout. 6790The optional second word is the number of minutes of inactivity 6791before automatic locking. 6792When the shell automatically logs out, it prints 6793.Sq auto-logout 6794, sets the 6795variable 6796.Va logout 6797to 6798.Sq automatic 6799and exits. 6800When the shell automatically locks, the user is required to enter his password 6801to continue working. 6802Five incorrect attempts result in automatic logout. 6803Set to 6804.Sq 60 6805(automatic logout after 60 minutes, and no locking) by default 6806in login and superuser shells, but not if the shell thinks it is running 6807under a window system (i.e., the 6808.Va DISPLAY 6809environment variable is set), 6810the tty is a pseudo-tty (pty) or the shell was not so compiled (see the 6811.Va version 6812shell variable). 6813See also the 6814.Va afsuser 6815and 6816.Va logout 6817shell variables. 6818.TP 8 6819.B autorehash \fR(+) 6820If set, the internal hash table of the contents of the directories in the 6821.Va path 6822variable will be recomputed if a command is not found in the hash 6823table. 6824In addition, the list of available commands will be rebuilt for each 6825command completion or spelling correction attempt if set to 6826.Sq complete 6827or 6828`correct' respectively; if set to 6829.Sq always 6830, this will be done for both 6831cases. 6832.TP 8 6833.B backslash_quote \fR(+) 6834.\" TODO 6835If set, backslashes (`\e') always quote 6836.Sq \e 6837, 6838.Sq \&' , 6839and 6840.Sq \&" 6841This may make 6842complex quoting tasks easier, but it can cause syntax errors in 6843.Xr csh 1 6844scripts. 6845.TP 8 6846.B catalog 6847The file name of the message catalog. 6848If set, tcsh use 6849.Sq tcsh.${catalog} 6850as a message catalog instead of 6851default 6852.Sq tcsh 6853.TP 8 6854.B cdpath 6855A list of directories in which 6856.Va cd 6857should search for 6858subdirectories if they aren't found in the current directory. 6859.TP 8 6860.B cdtohome \fR(+) 6861If not set, 6862.Va cd 6863requires a directory 6864.Va name 6865, and will not go to the 6866.Va home 6867directory if it's omitted. 6868This is set by default. 6869.TP 8 6870.B color 6871If set, it enables color display for the builtin \fBls\-F\fR and it passes 6872.Fl \-color=auto\fR to 6873.Va ls 6874Alternatively, it can be set to only 6875\fBls\-F\fR or only 6876.Va ls 6877to enable color to only one command. 6878Setting 6879it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR. 6880.TP 8 6881.B colorcat 6882If set, it enables color escape sequence for NLS message files. 6883And display colorful NLS messages. 6884.TP 8 6885.B command \fR(+) 6886If set, the command which was passed to the shell with the 6887.Va -c 6888flag (q.v.). 6889.TP 8 6890.B compat_expr \fR(+) 6891If set, the shell will evaluate expressions right to left, like the original 6892.Xr csh 1 6893.TP 8 6894.B complete \fR(+) 6895If set to 6896.Sq igncase 6897, the completion becomes case insensitive. 6898If set to 6899.Sq enhance 6900, completion ignores case and considers 6901hyphens and underscores to be equivalent; it will also treat 6902periods, hyphens and underscores (`.', 6903.Sq \- 6904and 6905.Sq _ 6906) as word 6907separators. 6908If set to 6909.Sq Enhance 6910, completion matches uppercase and underscore 6911characters explicitly and matches lowercase and hyphens in a 6912case-insensitive manner; it will treat periods, hyphens and underscores 6913as word separators. 6914.TP 8 6915.B continue \fR(+) 6916If set to a list of commands, the shell will continue the listed 6917commands, instead of starting a new one. 6918.TP 8 6919.B continue_args \fR(+) 6920Same as continue, but the shell will execute: 6921.RS +8 6922.IP "" 4 6923echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd> 6924.RE 6925.TP 8 6926.B correct \fR(+) 6927If set to 6928.Sq cmd 6929, commands are automatically spelling-corrected. 6930If set to 6931.Sq complete 6932, commands are automatically completed. 6933If set to 6934.Sq all 6935, the entire command line is corrected. 6936.TP 8 6937.B csubstnonl \fR(+) 6938If set, newlines and carriage returns in command substitution are 6939replaced by spaces. 6940Set by default. 6941.TP 8 6942.B cwd 6943The full pathname of the current directory. 6944See also the 6945.Va dirstack 6946and 6947.Va owd 6948shell variables. 6949.TP 8 6950.B dextract \fR(+) 6951If set, 6952.Sq pushd + 6953.Va n 6954extracts the 6955.Va n 6956th directory from the directory 6957stack rather than rotating it to the top. 6958.TP 8 6959.B dirsfile \fR(+) 6960The default location in which 6961.Sq dirs \-S 6962and 6963.Sq dirs \-L 6964look for 6965a history file. 6966If unset, 6967.Va ~/.cshdirs 6968is used. 6969Because only 6970.Va ~/.tcshrc 6971is normally sourced before 6972.Va ~/.cshdirs 6973, 6974.Va dirsfile 6975should be set in 6976.Va ~/.tcshrc 6977rather than 6978.Va ~/.login 6979.TP 8 6980.B dirstack \fR(+) 6981An array of all the directories on the directory stack. 6982`$dirstack[1]' is the current working directory, 6983.Sq $dirstack[2] 6984the first directory on the stack, etc. 6985Note that the current working directory is 6986.Sq $dirstack[1] 6987but 6988.Sq =0 6989in 6990directory stack substitutions, etc. 6991One can change the stack arbitrarily by setting 6992.Va dirstack 6993, 6994but the first element (the current working directory) is always correct. 6995See also the 6996.Va cwd 6997and 6998.Va owd 6999shell variables. 7000.TP 8 7001.B dspmbyte \fR(+) 7002Has an effect iff 'dspm' is listed as part of the 7003.Va version 7004shell variable. 7005If set to 7006.Sq euc 7007, it enables display and editing EUC-kanji(Japanese) code. 7008If set to 7009.Sq sjis 7010, it enables display and editing Shift-JIS(Japanese) code. 7011If set to 7012.Sq big5 7013, it enables display and editing Big5(Chinese) code. 7014If set to 7015.Sq utf8 7016, it enables display and editing Utf8(Unicode) code. 7017If set to the following format, it enables display and editing of original 7018multi-byte code format: 7019.RS +8 7020.IP "" 4 7021> set dspmbyte = 0000....(256 bytes)....0000 7022.Pp 7023The table requires 7024.Va just 7025256 bytes. 7026Each character of 256 characters 7027corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff. 7028Each 7029character 7030.\" (position in this table?) 7031is set to number 0,1,2 and 3. 7032Each number has the following meaning: 7033.br 70340 ... not used for multi-byte characters. 7035.br 70361 ... used for the first byte of a multi-byte character. 7037.br 70382 ... used for the second byte of a multi-byte character. 7039.br 70403 ... used for both the first byte and second byte of a multi-byte character. 7041.\" SHK: I tried my best to get the following to be grammatically correct. 7042.\" However, I still don't understand what's going on here. 7043In the 7044.\" following example, there are three bytes, but the text seems to refer to 7045.\" each nybble as a character. 7046What's going on here? It this 3-byte code 7047.\" in the table? The text above seems to imply that there are 256 7048.\" characters/bytes in the table. 7049If I get some more info on this (perhaps 7050.\" a complete example), I could fix the text to be grammatically correct. 7051.\" (steve.kelem@xilinx.com 1999/09/13) 7052.Pp 7053Example: 7054.br 7055If set to 7056.Sq 001322 7057, the first character (means 0x00 of the ASCII code) and 7058second character (means 0x01 of ASCII code) are set to 7059.Sq 0 7060Then, it is not 7061used for multi-byte characters. 7062The 3rd character (0x02) is set to '1', 7063indicating that it is used for the first byte of a multi-byte character. 7064The 4th character(0x03) is set '3'. 7065It is used for both the first byte and 7066the second byte of a multi-byte character. 7067The 5th and 6th characters 7068(0x04,0x05) are set to '2', indicating that they are used for the second 7069byte of a multi-byte character. 7070.Pp 7071The GNU fileutils version of ls cannot display multi-byte 7072filenames without the -N ( --literal ) option. 7073If you are using 7074this version, set the second word of dspmbyte to "ls". 7075If not, for 7076example, "ls-F -l" cannot display multi-byte filenames. 7077.Pp 7078Note: 7079.br 7080This variable can only be used if KANJI and DSPMBYTE has been defined at 7081compile time. 7082.RE 7083.TP 8 7084.B dunique \fR(+) 7085If set, 7086.Va pushd 7087removes any instances of 7088.Va name 7089from the stack before pushing it onto the stack. 7090.TP 8 7091.B echo 7092If set, each command with its arguments is echoed just before it is 7093executed. 7094For non-builtin commands all expansions occur before 7095echoing. 7096Builtin commands are echoed before command and filename 7097substitution, because these substitutions are then done selectively. 7098Set by the 7099.Fl x\fR command line option. 7100.TP 8 7101.B echo_style \fR(+) 7102The style of the 7103.Va echo 7104builtin. 7105May be set to 7106.Pp 7107.RS +8 7108.PD 0 7109.TP 8 7110bsd 7111Don't echo a newline if the first argument is 7112.Sq \-n ; 7113the default for 7114.Xr csh 1 7115.TP 8 7116sysv 7117Recognize backslashed escape sequences in echo strings. 7118.TP 8 7119both 7120Recognize both the 7121.Sq \-n 7122flag and backslashed escape sequences; the default 7123for 7124.Nm 7125.TP 8 7126none 7127Recognize neither. 7128.PD 7129.Pp 7130Set by default to the local system default. 7131The BSD and System V 7132options are described in the 7133.Va echo 7134(1) man pages on the appropriate 7135systems. 7136.RE 7137.TP 8 7138.B edit \fR(+) 7139If set, the command-line editor is used. 7140Set by default in interactive 7141shells. 7142.TP 8 7143.B editors \fR(+) 7144A list of command names for the 7145.Va run-fg-editor 7146editor command to match. 7147If not set, the 7148.Va EDITOR 7149(`ed' if unset) and 7150.Va VISUAL 7151(`vi' if unset) 7152environment variables will be used instead. 7153.TP 8 7154.B ellipsis \fR(+) 7155If set, the 7156.Sq %c 7157/`%.' and 7158.Sq %C 7159prompt sequences (see the 7160.Va prompt 7161shell variable) indicate skipped directories with an ellipsis (`...') 7162instead of 7163.Sq /<skipped> 7164.TP 8 7165.B euid \fR(+) 7166The user's effective user ID. 7167.TP 8 7168.B euser \fR(+) 7169The first matching passwd entry name corresponding to the effective user ID. 7170.TP 8 7171.B fignore \fR(+) 7172Lists file name suffixes to be ignored by completion. 7173.TP 8 7174.B filec 7175In 7176.Nm 7177, completion is always used and this variable is ignored 7178by default. If 7179.B edit 7180is unset, then the traditional 7181.Xr csh 1 7182completion is used. 7183If set in 7184.Xr csh 1 7185, filename completion is used. 7186.TP 8 7187.B gid \fR(+) 7188The user's real group ID. 7189.TP 8 7190.B globdot \fR(+) 7191If set, wild-card glob patterns will match files and directories beginning 7192with 7193.Sq . 7194except for 7195.Sq . 7196and 7197.Sq .. 7198.TP 8 7199.B globstar \fR(+) 7200If set, the 7201.Sq ** 7202and 7203.Sq *** 7204file glob patterns will match any string of 7205characters including 7206.Sq / 7207traversing any existing sub-directories. 7208(e.g. 7209`ls **.c' will list all the .c files in the current directory tree). 7210If used by itself, it will match zero or more sub-directories 7211(e.g. 7212.Sq ls /usr/include/**/time.h 7213will list any file named 7214.Sq time.h 7215in the /usr/include directory tree; whereas 7216.Sq ls /usr/include/**time.h 7217will match any file in the /usr/include directory tree ending in 7218.Sq time.h 7219). 7220To prevent problems with recursion, the 7221.Sq ** 7222glob-pattern will not 7223descend into a symbolic link containing a directory. 7224To override this, 7225use 7226.Sq *** 7227.TP 8 7228.B group \fR(+) 7229The user's group name. 7230.TP 8 7231.B highlight 7232If set, the incremental search match (in 7233.Va i-search-back 7234and 7235.Va i-search-fwd 7236) and the region between the mark and the cursor are 7237highlighted in reverse video. 7238.IP "" 8 7239Highlighting requires more frequent terminal writes, which introduces extra 7240overhead. If you care about terminal performance, you may want to leave this 7241unset. 7242.TP 8 7243.B histchars 7244A string value determining the characters used in \fBHistory 7245substitution\fR (q.v.). 7246The first character of its value is used as 7247the history substitution character, replacing the default character 7248`!'. 7249The second character of its value replaces the character 7250.Sq ^ 7251in 7252quick substitutions. 7253.TP 8 7254.B histdup \fR(+) 7255Controls handling of duplicate entries in the history list. 7256If set to 7257`all' only unique history events are entered in the history list. 7258If 7259set to 7260.Sq prev 7261and the last history event is the same as the current 7262command, then the current command is not entered in the history. 7263If 7264set to 7265.Sq erase 7266and the same event is found in the history list, that 7267old event gets erased and the current one gets inserted. 7268Note that the 7269`prev' and 7270.Sq all 7271options renumber history events so there are no gaps. 7272.TP 8 7273.B histfile \fR(+) 7274The default location in which 7275.Sq history \-S 7276and 7277.Sq history \-L 7278look for 7279a history file. 7280If unset, 7281.Va ~/.history 7282is used. 7283.Va histfile 7284is 7285useful when sharing the same home directory between different machines, 7286or when saving separate histories on different terminals. 7287Because only 7288.Va ~/.tcshrc 7289is normally sourced before 7290.Va ~/.history 7291, 7292.Va histfile 7293should be set in 7294.Va ~/.tcshrc 7295rather than 7296.Va ~/.login 7297.TP 8 7298.B histlit \fR(+) 7299If set, builtin and editor commands and the 7300.Va savehist 7301mechanism 7302use the literal (unexpanded) form of lines in the history list. 7303See 7304also the 7305.Va toggle-literal-history 7306editor command. 7307.TP 8 7308.B history 7309The first word indicates the number of history events to save. 7310The 7311optional second word (+) indicates the format in which history is 7312printed; if not given, 7313.Sq %h\et%T\et%R\en 7314is used. 7315The format sequences 7316are described below under 7317.Va prompt 7318; note the variable meaning of 7319`%R'. 7320Set to 7321.Sq 100 7322by default. 7323.TP 8 7324.B home 7325Initialized to the home directory of the invoker. 7326The filename 7327expansion of 7328.Sq 7329.Va ~ 7330refers to this variable. 7331.TP 8 7332.B ignoreeof 7333If set to the empty string or 7334.Sq 0 7335and the input device is a terminal, 7336the 7337.Va end-of-file 7338command (usually generated by the user by typing 7339`^D' on an empty line) causes the shell to print `Use "exit" to leave 7340tcsh.' instead of exiting. 7341This prevents the shell from accidentally 7342being killed. 7343Historically this setting exited after 26 successive 7344EOF's to avoid infinite loops. 7345If set to a number 7346.Va n 7347, the shell 7348ignores 7349.Va n - 1 7350consecutive 7351.Va end-of-file 7352s and exits on the 7353.Va n 7354th. 7355(+) If unset, 7356.Sq 1 7357is used, i.e., the shell exits on a 7358single 7359.Sq ^D 7360.TP 8 7361.B implicitcd \fR(+) 7362If set, the shell treats a directory name typed as a command as though 7363it were a request to change to that directory. 7364If set to 7365.Va verbose 7366, 7367the change of directory is echoed to the standard output. 7368This behavior 7369is inhibited in non-interactive shell scripts, or for command strings 7370with more than one word. 7371Changing directory takes precedence over 7372executing a like-named command, but it is done after alias 7373substitutions. 7374Tilde and variable expansions work as expected. 7375.TP 8 7376.B inputmode \fR(+) 7377If set to 7378.Sq insert 7379or 7380.Sq overwrite 7381, puts the editor into that input mode 7382at the beginning of each line. 7383.TP 8 7384.B killdup \fR(+) 7385Controls handling of duplicate entries in the kill ring. 7386If set to 7387`all' only unique strings are entered in the kill ring. 7388If set to 7389`prev' and the last killed string is the same as the current killed 7390string, then the current string is not entered in the ring. 7391If set 7392to 7393.Sq erase 7394and the same string is found in the kill ring, the old 7395string is erased and the current one is inserted. 7396.TP 8 7397.B killring \fR(+) 7398Indicates the number of killed strings to keep in memory. 7399Set to 7400.Sq 30 7401by default. 7402If unset or set to less than 7403.Sq 2 7404, the shell will only 7405keep the most recently killed string. 7406Strings are put in the killring by the editor commands that delete 7407(kill) strings of text, e.g. 7408.Va backward-delete-word 7409, 7410.Va kill-line 7411, etc, as well as the 7412.Va copy-region-as-kill 7413command. 7414The 7415.Va yank 7416editor command will yank the most recently killed string 7417into the command-line, while 7418.Va yank-pop 7419(see 7420.Va Editor commands 7421) 7422can be used to yank earlier killed strings. 7423.TP 8 7424.B listflags \fR(+) 7425If set to 7426.Sq x 7427, 7428.Sq a 7429or 7430.Sq A 7431, or any combination thereof (e.g., 7432.Sq xA 7433), they 7434are used as flags to \fIls\-F\fR, making it act like 7435.Sq ls \-xF 7436, `ls 7437\-Fa', 7438.Sq ls \-FA 7439or a combination (e.g., 7440.Sq ls \-FxA 7441): 7442.Sq a 7443shows all 7444files (even if they start with a 7445.Sq . 7446), 7447.Sq A 7448shows all files but 7449.Sq . 7450and 7451`..', and 7452.Sq x 7453sorts across instead of down. 7454If the second word of 7455.Va listflags 7456is set, it is used as the path to 7457.Sq ls(1) 7458.TP 8 7459.B listjobs \fR(+) 7460If set, all jobs are listed when a job is suspended. 7461If set to 7462.Sq long 7463, 7464the listing is in long format. 7465.TP 8 7466.B listlinks \fR(+) 7467If set, the \fIls\-F\fR builtin command shows the type of file to which 7468each symbolic link points. 7469.TP 8 7470.B listmax \fR(+) 7471The maximum number of items which the 7472.Va list-choices 7473editor command 7474will list without asking first. 7475.TP 8 7476.B listmaxrows \fR(+) 7477The maximum number of rows of items which the 7478.Va list-choices 7479editor 7480command will list without asking first. 7481.TP 8 7482.B loginsh \fR(+) 7483Set by the shell if it is a login shell. 7484Setting or unsetting it 7485within a shell has no effect. 7486See also 7487.Va shlvl 7488.TP 8 7489.B logout \fR(+) 7490Set by the shell to 7491.Sq normal 7492before a normal logout, 7493.Sq automatic 7494before 7495an automatic logout, and 7496.Sq hangup 7497if the shell was killed by a hangup 7498signal (see 7499.Va Signal handling 7500). 7501See also the 7502.Va autologout 7503shell variable. 7504.TP 8 7505.B mail 7506A list of files and directories to check for incoming mail, optionally 7507preceded by a numeric word. 7508Before each prompt, if 10 minutes have 7509passed since the last check, the shell checks each file and says `You 7510have new mail.' (or, if 7511.Va mail 7512contains multiple files, `You have 7513new mail in 7514.Va name 7515.') if the filesize is greater than zero in size 7516and has a modification time greater than its access time. 7517.Pp 7518.RS +8 7519.PD 7520.Pp 7521If you are in a login shell, then no mail file is reported unless it has 7522been modified after the time the shell has started up, to prevent 7523redundant notifications. 7524Most login programs will tell you whether or not 7525you have mail when you log in. 7526.Pp 7527If a file specified in 7528.Va mail 7529is a directory, the shell will count each 7530file within that directory as a separate message, and will report `You have 7531.Va n 7532mails.' or 7533.Sq You have 7534.Va n 7535mails in 7536.Va name 7537as appropriate. 7538This functionality is provided primarily for those systems which store mail 7539in this manner, such as the Andrew Mail System. 7540.Pp 7541If the first word of 7542.Va mail 7543is numeric it is taken as a different mail 7544checking interval, in seconds. 7545.Pp 7546Under very rare circumstances, the shell may report 7547.Sq You have mail. 7548instead 7549of 7550.Sq You have new mail. 7551.RE 7552.TP 8 7553.B matchbeep \fR(+) 7554If set to 7555.Sq never 7556, completion never beeps. 7557If set to 7558.Sq nomatch 7559, it beeps only when there is no match. 7560If set to 7561.Sq ambiguous 7562, it beeps when there are multiple matches. 7563If set to 7564.Sq notunique 7565, it beeps when there is one exact and other longer matches. 7566If unset, 7567.Sq ambiguous 7568is used. 7569.TP 8 7570.B nobeep \fR(+) 7571If set, beeping is completely disabled. 7572See also 7573.Va visiblebell 7574.TP 8 7575.B noclobber 7576If set, restrictions are placed on output redirection to insure that files 7577are not accidentally destroyed and that 7578.Sq >> 7579redirections refer to existing 7580files, as described in the 7581.Va Input/output 7582section. 7583.TP 8 7584.B noding 7585If set, disable the printing of 7586.Sq DING! 7587in the 7588.Va prompt 7589time 7590specifiers at the change of hour. 7591.TP 8 7592.B noglob 7593If set, 7594.Va Filename substitution 7595and 7596.Va Directory stack substitution 7597(q.v.) are inhibited. 7598This is most useful in shell scripts which do not deal 7599with filenames, or after a list of filenames has been obtained and further 7600expansions are not desirable. 7601.TP 8 7602.B nokanji \fR(+) 7603If set and the shell supports Kanji (see the 7604.Va version 7605shell variable), 7606it is disabled so that the meta key can be used. 7607.TP 8 7608.B nonomatch 7609If set, a 7610.Va Filename substitution 7611or 7612.Va Directory stack substitution 7613(q.v.) which does not match any 7614existing files is left untouched rather than causing an error. 7615It is still an error for the substitution to be 7616malformed, e.g., 7617.Sq echo [ 7618still gives an error. 7619.TP 8 7620.B nostat \fR(+) 7621A list of directories (or glob-patterns which match directories; see 7622.Va Filename substitution 7623) that should not be 7624.Va stat 7625(2)ed during a 7626completion operation. 7627This is usually used to exclude directories which 7628take too much time to 7629.Va stat 7630(2), for example 7631.Va /afs 7632.TP 8 7633.B notify 7634If set, the shell announces job completions asynchronously. 7635The default is to present job completions just before printing a prompt. 7636.TP 8 7637.B oid \fR(+) 7638The user's real organization ID. 7639(Domain/OS only) 7640.TP 8 7641.B owd \fR(+) 7642The old working directory, equivalent to the 7643.Sq \- 7644used by 7645.Va cd 7646and 7647.Va pushd 7648See also the 7649.Va cwd 7650and 7651.Va dirstack 7652shell variables. 7653.TP 8 7654.B padhour 7655If set, enable the printing of padding '0' for hours, in 24 and 12 hour 7656formats. 7657E.G.: 07:45:42 vs. 7:45:42. 7658.TP 8 7659.B parseoctal 7660To retain compatibily with older versions numeric variables starting with 76610 are not interpreted as octal. Setting this variable enables proper octal 7662parsing. 7663.TP 8 7664.B path 7665A list of directories in which to look for executable commands. 7666A null word specifies the current directory. 7667If there is no 7668.Va path 7669variable then only full path names will execute. 7670.Va path 7671is set by the shell at startup from the 7672.Va PATH 7673environment 7674variable or, if 7675.Va PATH 7676does not exist, to a system-dependent default 7677something like 7678.Sq (/usr/local/bin /usr/bsd /bin /usr/bin .) 7679The shell may put 7680.Sq . 7681first or last in 7682.Va path 7683or omit it entirely 7684depending on how it was compiled; see the 7685.Va version 7686shell variable. 7687A shell which is given neither the 7688.Fl c\fR nor the 7689.Fl t\fR option 7690hashes the contents of the directories in 7691.Va path 7692after 7693reading 7694.Va ~/.tcshrc 7695and each time 7696.Va path 7697is reset. 7698If one adds a new command to a directory in 7699.Va path 7700while the shell 7701is active, one may need to do a 7702.Va rehash 7703for the shell to find it. 7704.TP 8 7705.B printexitvalue \fR(+) 7706If set and an interactive program exits with a non-zero status, the shell 7707prints 7708.Sq Exit 7709.Va status 7710.TP 8 7711.B prompt 7712The string which is printed before reading each command from the terminal. 7713.Va prompt 7714may include any of the following formatting sequences (+), which 7715are replaced by the given information: 7716.Pp 7717.RS +8 7718.PD 0 7719.TP 4 7720%/ 7721The current working directory. 7722.TP 4 7723%~ 7724The current working directory, but with one's home directory 7725represented by 7726.Sq ~ 7727and other users' home directories represented by 7728`~user' as per 7729.Va Filename substitution 7730`~user' substitution 7731happens only if the shell has already used 7732.Sq ~ 7733.Va user 7734in a pathname 7735in the current session. 7736.TP 4 7737%c[[0] 7738.Va n 7739], %.[[0] 7740.Va n 7741] 7742The trailing component of the current working directory, or 7743.Va n 7744trailing components if a digit 7745.Va n 7746is given. 7747If 7748.Va n 7749begins with 7750.Sq 0 7751, the number of skipped components precede 7752the trailing component(s) in the format 7753.Sq /< 7754.Va skipped 7755>trailing 7756If the 7757.Va ellipsis 7758shell variable is set, skipped components 7759are represented by an ellipsis so the whole becomes 7760.Sq ...trailing 7761`~' substitution is done as in 7762.Sq %~ 7763above, but the 7764.Sq ~ 7765component 7766is ignored when counting trailing components. 7767.TP 4 7768%C 7769Like %c, but without 7770.Sq ~ 7771substitution. 7772.TP 4 7773%h, %!, ! 7774The current history event number. 7775.TP 4 7776%M 7777The full hostname. 7778.TP 4 7779%m 7780The hostname up to the first 7781.Sq . 7782.TP 4 7783%S (%s) 7784Start (stop) standout mode. 7785.TP 4 7786%B (%b) 7787Start (stop) boldfacing mode. 7788.TP 4 7789%U (%u) 7790Start (stop) underline mode. 7791.TP 4 7792%t, %@ 7793The time of day in 12-hour AM/PM format. 7794.TP 4 7795%T 7796Like 7797.Sq %t 7798, but in 24-hour format (but see the 7799.Va ampm 7800shell variable). 7801.TP 4 7802%p 7803The 7804.Sq precise 7805time of day in 12-hour AM/PM format, with seconds. 7806.TP 4 7807%P 7808Like 7809.Sq %p 7810, but in 24-hour format (but see the 7811.Va ampm 7812shell variable). 7813.TP 4 7814\e 7815.Va c 7816.Va c 7817is parsed as in 7818.Va bindkey 7819.TP 4 7820^ 7821.Va c 7822.Va c 7823is parsed as in 7824.Va bindkey 7825.TP 4 7826%% 7827A single 7828.Sq % 7829.TP 4 7830%n 7831The user name. 7832.TP 4 7833%N 7834The effective user name. 7835.TP 4 7836%j 7837The number of jobs. 7838.TP 4 7839%d 7840The weekday in 7841.Sq Day 7842format. 7843.TP 4 7844%D 7845The day in 7846.Sq dd 7847format. 7848.TP 4 7849%w 7850The month in 7851.Sq Mon 7852format. 7853.TP 4 7854%W 7855The month in 7856.Sq mm 7857format. 7858.TP 4 7859%y 7860The year in 7861.Sq yy 7862format. 7863.TP 4 7864%Y 7865The year in 7866.Sq yyyy 7867format. 7868.TP 4 7869%l 7870The shell's tty. 7871.TP 4 7872%L 7873Clears from the end of the prompt to end of the display or the end of the line. 7874.TP 4 7875%$ 7876Expands the shell or environment variable name immediately after the 7877.Sq $ 7878.TP 4 7879%# 7880`>' (or the first character of the 7881.Va promptchars 7882shell variable) 7883for normal users, 7884.Sq # 7885(or the second character of 7886.Va promptchars 7887) 7888for the superuser. 7889.TP 4 7890%{ 7891.Va string 7892%} 7893Includes 7894.Va string 7895as a literal escape sequence. 7896It should be used only to change terminal attributes and 7897should not move the cursor location. 7898This 7899cannot be the last sequence in 7900.Va prompt 7901.TP 4 7902%? 7903The return code of the command executed just before the prompt. 7904.TP 4 7905%R 7906In 7907.Va prompt2 7908, the status of the parser. 7909In 7910.Va prompt3 7911, the corrected string. 7912In 7913.Va history 7914, the history string. 7915.PD 7916.Pp 7917`%B', 7918.Sq %S 7919, 7920.Sq %U 7921and 7922.Sq %{ 7923.Va string 7924%} 7925are available in only 7926eight-bit-clean shells; see the 7927.Va version 7928shell variable. 7929.Pp 7930The bold, standout and underline sequences are often used to distinguish a 7931superuser shell. 7932For example, 7933.IP "" 4 7934> set prompt = "%m [%h] %B[%@]%b [%/] you rang? " 7935.br 7936tut [37] 7937.Va [2:54pm] 7938[/usr/accts/sys] you rang? _ 7939.Pp 7940If 7941.Sq %t 7942, 7943.Sq %@ 7944, 7945.Sq %T 7946, 7947.Sq %p 7948, or 7949.Sq %P 7950is used, and 7951.Va noding 7952is not set, 7953then print 7954.Sq DING! 7955on the change of hour (i.e, 7956.Sq \&:00 7957minutes) instead of 7958the actual time. 7959.Pp 7960Set by default to 7961.Sq %# 7962in interactive shells. 7963.RE 7964.TP 8 7965.B prompt2 \fR(+) 7966The string with which to prompt in 7967.Va while 7968and 7969.Va foreach 7970loops and 7971after lines ending in 7972.Sq \e 7973The same format sequences may be used as in 7974.Va prompt 7975(q.v.); 7976note the variable meaning of 7977.Sq %R 7978Set by default to 7979.Sq %R? 7980in interactive shells. 7981.TP 8 7982.B prompt3 \fR(+) 7983The string with which to prompt when confirming automatic spelling correction. 7984The same format sequences may be used as in 7985.Va prompt 7986(q.v.); 7987note the variable meaning of 7988.Sq %R 7989Set by default to 7990.Sq CORRECT>%R (y|n|e|a)? 7991in interactive shells. 7992.TP 8 7993.B promptchars \fR(+) 7994If set (to a two-character string), the 7995.Sq %# 7996formatting sequence in the 7997.Va prompt 7998shell variable is replaced with the first character for 7999normal users and the second character for the superuser. 8000.TP 8 8001.B pushdtohome \fR(+) 8002If set, 8003.Va pushd 8004without arguments does 8005.Sq pushd ~ 8006, like 8007.Va cd 8008.TP 8 8009.B pushdsilent \fR(+) 8010If set, 8011.Va pushd 8012and 8013.Va popd 8014do not print the directory stack. 8015.TP 8 8016.B recexact \fR(+) 8017If set, completion completes on an exact match even if a longer match is 8018possible. 8019.TP 8 8020.B recognize_only_executables \fR(+) 8021If set, command listing displays only files in the path that are 8022executable. 8023Slow. 8024.TP 8 8025.B rmstar \fR(+) 8026If set, the user is prompted before 8027.Sq rm * 8028is executed. 8029.TP 8 8030.B rprompt \fR(+) 8031The string to print on the right-hand side of the screen (after 8032the command input) when the prompt is being displayed on the left. 8033It recognizes the same formatting characters as 8034.Va prompt 8035It will automatically disappear and reappear as necessary, to ensure that 8036command input isn't obscured, and will appear only if the prompt, 8037command input, and itself will fit together on the first line. 8038If 8039.Va edit 8040isn't set, then 8041.Va rprompt 8042will be printed after 8043the prompt and before the command input. 8044.TP 8 8045.B savedirs \fR(+) 8046If set, the shell does 8047.Sq dirs \-S 8048before exiting. 8049If the first word is set to a number, at most that many directory stack 8050entries are saved. 8051.TP 8 8052.B savehist 8053If set, the shell does 8054.Sq history \-S 8055before exiting. 8056If the first word is set to a number, at most that many lines are saved. 8057(The number should be less than or equal to the number 8058.Va history 8059entries; 8060if it is set to greater than the number of 8061.Va history 8062settings, only 8063.Va history 8064entries will be saved) 8065If the second word is set to 8066.Sq merge 8067, the history list is merged with 8068the existing history file instead of replacing it (if there is one) and 8069sorted by time stamp and the most recent events are retained. 8070If the second word of 8071.Va savehist 8072is 8073.Sq merge 8074and the third word is set to 8075`lock', the history file update will be serialized with other shell sessions 8076that would possibly like to merge history at exactly the same time. (+) 8077.TP 8 8078.B sched \fR(+) 8079The format in which the 8080.Va sched 8081builtin command prints scheduled events; 8082if not given, 8083.Sq %h\et%T\et%R\en 8084is used. 8085The format sequences are described above under 8086.Va prompt 8087; 8088note the variable meaning of 8089.Sq %R 8090.TP 8 8091.B shell 8092The file in which the shell resides. 8093This is used in forking 8094shells to interpret files which have execute bits set, but 8095which are not executable by the system. 8096(See the description 8097of 8098.Va Builtin and non-builtin command execution 8099.) Initialized to the 8100(system-dependent) home of the shell. 8101.TP 8 8102.B shlvl \fR(+) 8103The number of nested shells. 8104Reset to 1 in login shells. 8105See also 8106.Va loginsh 8107.TP 8 8108.B status 8109The exit status from the last command or backquote expansion, or any 8110command in a pipeline is propagated to 8111.Va status 8112(This is also the 8113default 8114.Xr csh 1 8115behavior.) 8116This default does not match what POSIX mandates (to return the 8117status of the last command only). To match the POSIX behavior, you need 8118to unset 8119.Va anyerror 8120.RS +8 8121.Pp 8122If the 8123.Va anyerror 8124variable is unset, the exit status of a pipeline 8125is determined only from the last command in the pipeline, and the exit 8126status of a backquote expansion is 8127.Va not 8128propagated to 8129.Va status 8130.Pp 8131If a command terminated abnormally, then 0200 is added to the status. 8132Builtin commands which fail return exit status 8133.Sq 1 8134, all other builtin 8135commands return status 8136.Sq 0 8137.RE 8138.TP 8 8139.B symlinks \fR(+) 8140Can be set to several different values to control symbolic link (`symlink') 8141resolution: 8142.RS +8 8143.Pp 8144If set to 8145.Sq chase 8146, whenever the current directory changes to a directory 8147containing a symbolic link, it is expanded to the real name of the directory 8148to which the link points. 8149This does not work for the user's home directory; 8150this is a bug. 8151.Pp 8152If set to 8153.Sq ignore 8154, the shell tries to construct a current directory 8155relative to the current directory before the link was crossed. 8156This means that 8157.Va cd 8158ing through a symbolic link and then 8159.Sq cd .. 8160ing 8161returns one to the original directory. 8162This affects only builtin commands 8163and filename completion. 8164.Pp 8165If set to 8166.Sq expand 8167, the shell tries to fix symbolic links by actually expanding 8168arguments which look like path names. 8169This affects any command, not just 8170builtins. 8171Unfortunately, this does not work for hard-to-recognize filenames, 8172such as those embedded in command options. 8173Expansion may be prevented by 8174quoting. 8175While this setting is usually the most convenient, it is sometimes 8176misleading and sometimes confusing when it fails to recognize an argument 8177which should be expanded. 8178A compromise is to use 8179.Sq ignore 8180and use the 8181editor command 8182.Va normalize-path 8183(bound by default to ^X-n) when necessary. 8184.Pp 8185Some examples are in order. 8186First, let's set up some play directories: 8187.IP "" 4 8188> cd /tmp 8189.br 8190> mkdir from from/src to 8191.br 8192> ln \-s from/src to/dst 8193.Pp 8194Here's the behavior with 8195.Va symlinks 8196unset, 8197.IP "" 4 8198> cd /tmp/to/dst; echo $cwd 8199.br 8200/tmp/to/dst 8201.br 8202> cd ..; echo $cwd 8203.br 8204/tmp/from 8205.Pp 8206here's the behavior with 8207.Va symlinks 8208set to 8209.Sq chase 8210, 8211.IP "" 4 8212> cd /tmp/to/dst; echo $cwd 8213.br 8214/tmp/from/src 8215.br 8216> cd ..; echo $cwd 8217.br 8218/tmp/from 8219.Pp 8220here's the behavior with 8221.Va symlinks 8222set to 8223.Sq ignore 8224, 8225.IP "" 4 8226> cd /tmp/to/dst; echo $cwd 8227.br 8228/tmp/to/dst 8229.br 8230> cd ..; echo $cwd 8231.br 8232/tmp/to 8233.Pp 8234and here's the behavior with 8235.Va symlinks 8236set to 8237.Sq expand 8238.IP "" 4 8239> cd /tmp/to/dst; echo $cwd 8240.br 8241/tmp/to/dst 8242.br 8243> cd ..; echo $cwd 8244.br 8245/tmp/to 8246.br 8247> cd /tmp/to/dst; echo $cwd 8248.br 8249/tmp/to/dst 8250.br 8251> cd ".."; echo $cwd 8252.br 8253/tmp/from 8254.br 8255> /bin/echo .. 8256.br 8257/tmp/to 8258.br 8259> /bin/echo ".." 8260.br 8261\&.. 8262.Pp 8263Note that 8264.Sq expand 8265expansion 1) works just like 8266.Sq ignore 8267for builtins 8268like 8269.Va cd 8270, 2) is prevented by quoting, and 3) happens before 8271filenames are passed to non-builtin commands. 8272.RE 8273.TP 8 8274.B tcsh \fR(+) 8275The version number of the shell in the format 8276.Sq R.VV.Pp 8277, 8278where 8279.Sq R 8280is the major release number, 8281.Sq VV 8282the current version 8283and 8284.Sq PP 8285the patchlevel. 8286.TP 8 8287.B term 8288The terminal type. 8289Usually set in 8290.Va ~/.login 8291as described under 8292.Va Startup and shutdown 8293.TP 8 8294.B time 8295If set to a number, then the 8296.Va time 8297builtin (q.v.) executes automatically 8298after each command which takes more than that many CPU seconds. 8299If there is a second word, it is used as a format string for the output 8300of the 8301.Va time 8302builtin. 8303(u) The following sequences may be used in the 8304format string: 8305.Pp 8306.RS +8 8307.PD 0 8308.TP 4 8309%U 8310The time the process spent in user mode in cpu seconds. 8311.TP 4 8312%S 8313The time the process spent in kernel mode in cpu seconds. 8314.TP 4 8315%E 8316The elapsed (wall clock) time in seconds. 8317.TP 4 8318%P 8319The CPU percentage computed as (%U + %S) / %E. 8320.TP 4 8321%W 8322Number of times the process was swapped. 8323.TP 4 8324%X 8325The average amount in (shared) text space used in Kbytes. 8326.TP 4 8327%D 8328The average amount in (unshared) data/stack space used in Kbytes. 8329.TP 4 8330%K 8331The total space used (%X + %D) in Kbytes. 8332.TP 4 8333%M 8334The maximum memory the process had in use at any time in Kbytes. 8335.TP 4 8336%F 8337The number of major page faults (page needed to be brought from disk). 8338.TP 4 8339%R 8340The number of minor page faults. 8341.TP 4 8342%I 8343The number of input operations. 8344.TP 4 8345%O 8346The number of output operations. 8347.TP 4 8348%r 8349The number of socket messages received. 8350.TP 4 8351%s 8352The number of socket messages sent. 8353.TP 4 8354%k 8355The number of signals received. 8356.TP 4 8357%w 8358The number of voluntary context switches (waits). 8359.TP 4 8360%c 8361The number of involuntary context switches. 8362.PD 8363.Pp 8364Only the first four sequences are supported on systems without BSD resource 8365limit functions. 8366The default time format is 8367.Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww 8368for 8369systems that support resource usage reporting and 8370.Sq %Uu %Ss %E %P 8371for 8372systems that do not. 8373.Pp 8374Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not 8375available, but the following additional sequences are: 8376.Pp 8377.PD 0 8378.TP 4 8379%Y 8380The number of system calls performed. 8381.TP 4 8382%Z 8383The number of pages which are zero-filled on demand. 8384.TP 4 8385%i 8386The number of times a process's resident set size was increased by the kernel. 8387.TP 4 8388%d 8389The number of times a process's resident set size was decreased by the kernel. 8390.TP 4 8391%l 8392The number of read system calls performed. 8393.TP 4 8394%m 8395The number of write system calls performed. 8396.TP 4 8397%p 8398The number of reads from raw disk devices. 8399.TP 4 8400%q 8401The number of writes to raw disk devices. 8402.PD 8403.Pp 8404and the default time format is 8405.Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww 8406Note that the CPU percentage can be higher than 100% on multi-processors. 8407.RE 8408.TP 8 8409.B tperiod \fR(+) 8410The period, in minutes, between executions of the 8411.Va periodic 8412special alias. 8413.TP 8 8414.B tty \fR(+) 8415The name of the tty, or empty if not attached to one. 8416.TP 8 8417.B uid \fR(+) 8418The user's real user ID. 8419.TP 8 8420.B user 8421The user's login name. 8422.TP 8 8423.B verbose 8424If set, causes the words of each 8425command to be printed, after history substitution (if any). 8426Set by the 8427.Fl v\fR command line option. 8428.TP 8 8429.B version \fR(+) 8430The version ID stamp. 8431It contains the shell's version number (see 8432.Va tcsh 8433), 8434origin, release date, vendor, operating system and machine (see 8435.Va VENDOR 8436, 8437.Va OSTYPE 8438and 8439.Va MACHTYPE 8440) and a comma-separated 8441list of options which were set at compile time. 8442Options which are set by default in the distribution are noted. 8443.Pp 8444.RS +8 8445.PD 0 8446.TP 6 84478b 8448The shell is eight bit clean; default 8449.TP 6 84507b 8451The shell is not eight bit clean 8452.TP 6 8453wide 8454The shell is multibyte encoding clean (like UTF-8) 8455.TP 6 8456nls 8457The system's NLS is used; default for systems with NLS 8458.TP 6 8459lf 8460Login shells execute 8461.Va /etc/csh.login 8462before instead of after 8463.Va /etc/csh.cshrc 8464and 8465.Va ~/.login 8466before instead of after 8467.Va ~/.tcshrc 8468and 8469.Va ~/.history 8470.TP 6 8471dl 8472`.' is put last in 8473.Va path 8474for security; default 8475.TP 6 8476nd 8477`.' is omitted from 8478.Va path 8479for security 8480.TP 6 8481vi 8482.Va vi 8483(1)\-style editing is the default rather than 8484.Va emacs 8485(1)\-style 8486.TP 6 8487dtr 8488Login shells drop DTR when exiting 8489.TP 6 8490bye 8491.Va bye 8492is a synonym for 8493.Va logout 8494and 8495.Va log 8496is an alternate name for 8497.Va watchlog 8498.TP 6 8499al 8500.Va autologout 8501is enabled; default 8502.TP 6 8503kan 8504Kanji is used if appropriate according to locale settings, 8505unless the 8506.Va nokanji 8507shell variable is set 8508.TP 6 8509sm 8510The system's 8511.Va malloc 8512(3) is used 8513.TP 6 8514hb 8515The 8516.Sq #!<program> <args> 8517convention is emulated when executing shell scripts 8518.TP 6 8519ng 8520The 8521.Va newgrp 8522builtin is available 8523.TP 6 8524rh 8525The shell attempts to set the 8526.Va REMOTEHOST 8527environment variable 8528.TP 6 8529afs 8530The shell verifies your password with the kerberos server if local 8531authentication fails. 8532The 8533.Va afsuser 8534shell variable or the 8535.Va AFSUSER 8536environment variable override your local username if set. 8537.PD 8538.Pp 8539An administrator may enter additional strings to indicate differences 8540in the local version. 8541.RE 8542.TP 8 8543.B vimode \fR(+) 8544.RS +8 8545If unset, various key bindings change behavior to be more 8546.Va emacs 8547(1)\-style: 8548word boundaries are determined by 8549.Va wordchars 8550versus other characters. 8551.Pp 8552If set, various key bindings change behavior to be more 8553.Va vi 8554(1)\-style: 8555word boundaries are determined by 8556.Va wordchars 8557versus whitespace 8558versus other characters; 8559cursor behavior depends upon current vi mode (command, delete, insert, replace). 8560.Pp 8561This variable is unset by 8562.Va bindkey 8563 8564.Va -e 8565and 8566set by 8567.Va bindkey 8568 8569.Va -v 8570.B vimode 8571may be explicitly set or unset by the user after those 8572.Va bindkey 8573operations if required. 8574.RE 8575.TP 8 8576.B visiblebell \fR(+) 8577If set, a screen flash is used rather than the audible bell. 8578See also 8579.Va nobeep 8580.TP 8 8581.B watch \fR(+) 8582A list of user/terminal pairs to watch for logins and logouts. 8583If either the user is 8584.Sq any 8585all terminals are watched for the given user 8586and vice versa. 8587Setting 8588.Va watch 8589to 8590.Sq (any any) 8591watches all users and terminals. 8592For example, 8593.RS +8 8594.IP "" 4 8595set watch = (george ttyd1 any console $user any) 8596.Pp 8597reports activity of the user 8598.Sq george 8599on ttyd1, any user on the console, and 8600oneself (or a trespasser) on any terminal. 8601.Pp 8602Logins and logouts are checked every 10 minutes by default, but the first 8603word of 8604.Va watch 8605can be set to a number to check every so many minutes. 8606For example, 8607.IP "" 4 8608set watch = (1 any any) 8609.Pp 8610reports any login/logout once every minute. 8611For the impatient, the 8612.Va log 8613builtin command triggers a 8614.Va watch 8615report at any time. 8616All current logins 8617are reported (as with the 8618.Va log 8619builtin) when 8620.Va watch 8621is first set. 8622.Pp 8623The 8624.Va who 8625shell variable controls the format of 8626.Va watch 8627reports. 8628.RE 8629.TP 8 8630.B who \fR(+) 8631The format string for 8632.Va watch 8633messages. 8634The following sequences 8635are replaced by the given information: 8636.Pp 8637.RS +8 8638.PD 0 8639.TP 4 8640%n 8641The name of the user who logged in/out. 8642.TP 4 8643%a 8644The observed action, i.e., 8645.Sq logged on 8646, 8647.Sq logged off 8648or 8649.Sq replaced 8650.Va olduser 8651on 8652.TP 4 8653%l 8654The terminal (tty) on which the user logged in/out. 8655.TP 4 8656%M 8657The full hostname of the remote host, or 8658.Sq local 8659if the login/logout was 8660from the local host. 8661.TP 4 8662%m 8663The hostname of the remote host up to the first 8664.Sq . 8665The full name is printed if it is an IP address or an X Window System display. 8666.PD 8667.Pp 8668%M and %m are available on only systems that store the remote hostname in 8669.Va /etc/utmp 8670If unset, 8671.Sq %n has %a %l from %m. 8672is used, or 8673.Sq %n has %a %l. 8674on systems 8675which don't store the remote hostname. 8676.RE 8677.TP 8 8678.B wordchars \fR(+) 8679A list of non-alphanumeric characters to be considered part of a word by the 8680.Va forward-word 8681, 8682.Va backward-word 8683etc., editor commands. 8684If unset, the default value is determined based on the state of 8685.Va vimode 8686: 8687if 8688.Va vimode 8689is unset, 8690.Sq *?_\-.[]~= 8691is used as the default; 8692if 8693.Va vimode 8694is set, 8695.Sq _ 8696is used as the default. 8697.Sh ENVIRONMENT 8698.TP 8 8699.B AFSUSER \fR(+) 8700Equivalent to the 8701.Va afsuser 8702shell variable. 8703.TP 8 8704.B COLUMNS 8705The number of columns in the terminal. 8706See 8707.Va Terminal management 8708.TP 8 8709.B DISPLAY 8710Used by X Window System (see 8711.Va X 8712(1)). 8713If set, the shell does not set 8714.Va autologout 8715(q.v.). 8716.TP 8 8717.B EDITOR 8718The pathname to a default editor. 8719Used by the 8720.Va run-fg-editor 8721editor command if the 8722the 8723.Va editors 8724shell variable is unset. 8725See also the 8726.Va VISUAL 8727environment variable. 8728.TP 8 8729.B GROUP \fR(+) 8730Equivalent to the 8731.Va group 8732shell variable. 8733.TP 8 8734.B HOME 8735Equivalent to the 8736.Va home 8737shell variable. 8738.TP 8 8739.B HOST \fR(+) 8740Initialized to the name of the machine on which the shell 8741is running, as determined by the 8742.Va gethostname 8743(2) system call. 8744.TP 8 8745.B HOSTTYPE \fR(+) 8746Initialized to the type of machine on which the shell 8747is running, as determined at compile time. 8748This variable is obsolete and 8749will be removed in a future version. 8750.TP 8 8751.B HPATH \fR(+) 8752A colon-separated list of directories in which the 8753.Va run-help 8754editor 8755command looks for command documentation. 8756.TP 8 8757.B LANG 8758Gives the preferred character environment. 8759See 8760.Va Native Language System support 8761.TP 8 8762.B LC_CTYPE 8763If set, only ctype character handling is changed. 8764See 8765.Va Native Language System support 8766.TP 8 8767.B LINES 8768The number of lines in the terminal. 8769See 8770.Va Terminal management 8771.TP 8 8772.B LS_COLORS 8773The format of this variable is reminiscent of the 8774.Va termcap(5) 8775file format; a colon-separated list of expressions of the form 8776" 8777.Va xx=string 8778", where " 8779.Va xx 8780" is a two-character variable name. 8781The 8782variables with their associated defaults are: 8783.Pp 8784.RS +8 8785.RS +4 8786.PD 0 8787.TP 12 8788no 0 8789Normal (non-filename) text 8790.TP 12 8791fi 0 8792Regular file 8793.TP 12 8794di 01;34 8795Directory 8796.TP 12 8797ln 01;36 8798Symbolic link 8799.TP 12 8800pi 33 8801Named pipe (FIFO) 8802.TP 12 8803so 01;35 8804Socket 8805.TP 12 8806do 01;35 8807Door 8808.TP 12 8809bd 01;33 8810Block device 8811.TP 12 8812cd 01;32 8813Character device 8814.TP 12 8815ex 01;32 8816Executable file 8817.TP 12 8818mi (none) 8819Missing file (defaults to fi) 8820.TP 12 8821or (none) 8822Orphaned symbolic link (defaults to ln) 8823.TP 12 8824lc ^[[ 8825Left code 8826.TP 12 8827rc m 8828Right code 8829.TP 12 8830ec (none) 8831End code (replaces lc+no+rc) 8832.PD 8833.RE 8834.Pp 8835You need to include only the variables you want to change from 8836the default. 8837.Pp 8838File names can also be colorized based on filename extension. 8839This is specified in the 8840.Va LS_COLORS 8841variable using the syntax 8842.Va "*ext=string" 8843For example, using ISO 6429 codes, to color 8844all C\-language source files blue you would specify 8845.Va "*.c=34" 8846This would color all files ending in 8847.Va .c 8848in blue (34) color. 8849.Pp 8850Control characters can be written either in C\-style\-escaped 8851notation, or in stty\-like ^\-notation. 8852The C\-style notation 8853adds 8854.Va ^[ 8855for Escape, \fB\_\fR for a normal space character, 8856and 8857.Va ? 8858for Delete. 8859In addition, the 8860.Va ^[ 8861escape character 8862can be used to override the default interpretation of 8863.Va ^[ 8864, 8865.Va ^ 8866, 8867.Va : 8868and 8869.Va = 8870.Pp 8871Each file will be written as 8872.Va <lc> 8873 8874.Va <color-code> 8875.Va <rc> 8876 8877.Va <filename> 8878 8879.Va <ec> 8880If the 8881.Va <ec> 8882code is undefined, the sequence 8883.Va <lc> 8884\fB<no> 8885.Va <rc> 8886will be used instead. 8887This is generally more convenient 8888to use, but less general. 8889The left, right and end codes are 8890provided so you don't have to type common parts over and over 8891again and to support weird terminals; you will generally not 8892need to change them at all unless your terminal does not use 8893ISO 6429 color sequences but a different system. 8894.Pp 8895If your terminal does use ISO 6429 color codes, you can 8896compose the type codes (i.e., all except the 8897.Va lc 8898, 8899.Va rc 8900, 8901and 8902.Va ec 8903codes) from numerical commands separated by semicolons. 8904The 8905most common commands are: 8906.Pp 8907.RS +8 8908.PD 0 8909.TP 4 89100 8911to restore default color 8912.TP 4 89131 8914for brighter colors 8915.TP 4 89164 8917for underlined text 8918.TP 4 89195 8920for flashing text 8921.TP 4 892230 8923for black foreground 8924.TP 4 892531 8926for red foreground 8927.TP 4 892832 8929for green foreground 8930.TP 4 893133 8932for yellow (or brown) foreground 8933.TP 4 893434 8935for blue foreground 8936.TP 4 893735 8938for purple foreground 8939.TP 4 894036 8941for cyan foreground 8942.TP 4 894337 8944for white (or gray) foreground 8945.TP 4 894640 8947for black background 8948.TP 4 894941 8950for red background 8951.TP 4 895242 8953for green background 8954.TP 4 895543 8956for yellow (or brown) background 8957.TP 4 895844 8959for blue background 8960.TP 4 896145 8962for purple background 8963.TP 4 896446 8965for cyan background 8966.TP 4 896747 8968for white (or gray) background 8969.PD 8970.RE 8971.Pp 8972Not all commands will work on all systems or display devices. 8973.Pp 8974A few terminal programs do not recognize the default end code 8975properly. 8976If all text gets colorized after you do a directory 8977listing, try changing the 8978.Va no 8979and 8980.Va fi 8981codes from 0 to the 8982numerical codes for your standard fore- and background colors. 8983.RE 8984.TP 8 8985.B MACHTYPE \fR(+) 8986The machine type (microprocessor class or machine model), as determined at compile time. 8987.TP 8 8988.B NOREBIND \fR(+) 8989If set, printable characters are not rebound to 8990.Va self-insert-command 8991See 8992.Va Native Language System support 8993.TP 8 8994.B OSTYPE \fR(+) 8995The operating system, as determined at compile time. 8996.TP 8 8997.B PATH 8998A colon-separated list of directories in which to look for executables. 8999Equivalent to the 9000.Va path 9001shell variable, but in a different format. 9002.TP 8 9003.B PWD \fR(+) 9004Equivalent to the 9005.Va cwd 9006shell variable, but not synchronized to it; 9007updated only after an actual directory change. 9008.TP 8 9009.B REMOTEHOST \fR(+) 9010The host from which the user has logged in remotely, if this is the case and 9011the shell is able to determine it. 9012Set only if the shell was so compiled; 9013see the 9014.Va version 9015shell variable. 9016.TP 8 9017.B SHLVL \fR(+) 9018Equivalent to the 9019.Va shlvl 9020shell variable. 9021.TP 8 9022.B SYSTYPE \fR(+) 9023The current system type. 9024(Domain/OS only) 9025.TP 8 9026.B TERM 9027Equivalent to the 9028.Va term 9029shell variable. 9030.TP 8 9031.B TERMCAP 9032The terminal capability string. 9033See 9034.Va Terminal management 9035.TP 8 9036.B USER 9037Equivalent to the 9038.Va user 9039shell variable. 9040.TP 8 9041.B VENDOR \fR(+) 9042The vendor, as determined at compile time. 9043.TP 8 9044.B VISUAL 9045The pathname to a default full-screen editor. 9046Used by the 9047.Va run-fg-editor 9048editor command if the 9049the 9050.Va editors 9051shell variable is unset. 9052See also the 9053.Va EDITOR 9054environment variable. 9055.Sh FILES 9056.PD 0 9057.TP 16 9058.I /etc/csh.cshrc 9059Read first by every shell. 9060ConvexOS, Stellix and Intel use 9061.Va /etc/cshrc 9062and 9063NeXTs use 9064.Va /etc/cshrc.std 9065A/UX, AMIX, Cray and IRIX have no equivalent in 9066.Xr csh 1 9067, 9068but read this file in 9069.Nm 9070anyway. 9071Solaris 2.x does not have it either, but 9072.Nm 9073reads 9074.Va /etc/.cshrc 9075(+) 9076.TP 16 9077.I /etc/csh.login 9078Read by login shells after 9079.Va /etc/csh.cshrc 9080ConvexOS, Stellix and Intel use 9081.Va /etc/login 9082, 9083NeXTs use 9084.Va /etc/login.std 9085, Solaris 2.x uses 9086.Va /etc/.login 9087and 9088A/UX, AMIX, Cray and IRIX use 9089.Va /etc/cshrc 9090.TP 16 9091.I ~/.tcshrc \fR(+) 9092Read by every shell after 9093.Va /etc/csh.cshrc 9094or its equivalent. 9095.TP 16 9096.I ~/.cshrc 9097Read by every shell, if 9098.Va ~/.tcshrc 9099doesn't exist, 9100after 9101.Va /etc/csh.cshrc 9102or its equivalent. 9103This manual uses 9104.Sq 9105.Va ~/.tcshrc 9106to mean ` 9107.Va ~/.tcshrc 9108or, 9109if 9110.Va ~/.tcshrc 9111is not found, 9112.Va ~/.cshrc 9113'. 9114.TP 16 9115.I ~/.history 9116Read by login shells after 9117.Va ~/.tcshrc 9118if 9119.Va savehist 9120is set, but see also 9121.Va histfile 9122.TP 16 9123.I ~/.login 9124Read by login shells after 9125.Va ~/.tcshrc 9126or 9127.Va ~/.history 9128The shell may be compiled to read 9129.Va ~/.login 9130before instead of after 9131.Va ~/.tcshrc 9132and 9133.Va ~/.history 9134; see the 9135.Va version 9136shell variable. 9137.TP 16 9138.I ~/.cshdirs \fR(+) 9139Read by login shells after 9140.Va ~/.login 9141if 9142.Va savedirs 9143is set, but see also 9144.Va dirsfile 9145.TP 16 9146.I /etc/csh.logout 9147Read by login shells at logout. 9148ConvexOS, Stellix and Intel use 9149.Va /etc/logout 9150and 9151NeXTs use 9152.Va /etc/logout.std 9153A/UX, AMIX, Cray and IRIX have no equivalent in 9154.Xr csh 1 9155, 9156but read this file in 9157.Nm 9158anyway. 9159Solaris 2.x does not have it either, but 9160.Nm 9161reads 9162.Va /etc/.logout 9163(+) 9164.TP 16 9165.I ~/.logout 9166Read by login shells at logout after 9167.Va /etc/csh.logout 9168or its equivalent. 9169.TP 16 9170.I /bin/sh 9171Used to interpret shell scripts not starting with a 9172.Sq # 9173.TP 16 9174.I /tmp/sh* 9175Temporary file for 9176.Sq << 9177.TP 16 9178.I /etc/passwd 9179Source of home directories for 9180.Sq ~name 9181substitutions. 9182.PD 9183.Pp 9184The order in which startup files are read may differ if the shell was so 9185compiled; see 9186.Va Startup and shutdown 9187and the 9188.Va version 9189shell variable. 9190.Sh "NEW FEATURES (+)" 9191This manual describes 9192.Nm 9193as a single entity, 9194but experienced 9195.Xr csh 1 9196users will want to pay special attention to 9197.Nm 9198's new features. 9199.Pp 9200A command-line editor, which supports 9201.Va emacs 9202(1)\-style 9203or 9204.Va vi 9205(1)\-style key bindings. 9206See 9207.Va The command-line editor 9208and 9209.Va Editor commands 9210.Pp 9211Programmable, interactive word completion and listing. 9212See 9213.Sx Completion and listing 9214and the 9215.Va complete 9216and 9217.Va uncomplete 9218builtin commands. 9219.Pp 9220.Va Spelling correction 9221(q.v.) of filenames, commands and variables. 9222.Pp 9223.Va Editor commands 9224(q.v.) which perform other useful functions in the middle of 9225typed commands, including documentation lookup 9226.Va ( run-help ), 9227quick editor restarting 9228.Va ( run-fg-editor ) 9229and 9230command resolution 9231.Va ( which-command ). 9232.Pp 9233An enhanced history mechanism. 9234Events in the history list are time-stamped. 9235See also the 9236.Va history 9237command and its associated shell variables, 9238the previously undocumented 9239.Sq # 9240event specifier and new modifiers 9241under 9242.Va History substitution 9243, 9244the 9245.Va *-history 9246, 9247.Va history-search-* 9248, 9249.Va i-search-* 9250, 9251.Va vi-search-* 9252and 9253.Va toggle-literal-history 9254editor commands 9255and the 9256.Va histlit 9257shell variable. 9258.Pp 9259Enhanced directory parsing and directory stack handling. 9260See the 9261.Va cd 9262, 9263.Va pushd 9264, 9265.Va popd 9266and 9267.Va dirs 9268commands and their associated 9269shell variables, the description of 9270.Va Directory stack substitution 9271, 9272the 9273.Va dirstack 9274, 9275.Va owd 9276and 9277.Va symlinks 9278shell variables and 9279the 9280.Va normalize-command 9281and 9282.Va normalize-path 9283editor commands. 9284.Pp 9285Negation in glob-patterns. 9286See 9287.Va Filename substitution 9288.Pp 9289New 9290.Va File inquiry operators 9291(q.v.) and a 9292.Va filetest 9293builtin which uses them. 9294.Pp 9295A variety of 9296.Va Automatic, periodic and timed events 9297(q.v.) including 9298scheduled events, special aliases, automatic logout and terminal locking, 9299command timing and watching for logins and logouts. 9300.Pp 9301Support for the Native Language System 9302(see 9303.Va Native Language System support 9304), 9305OS variant features 9306(see 9307.Va OS variant support 9308and the 9309.Va echo_style 9310shell variable) 9311and system-dependent file locations (see 9312.Va FILES 9313). 9314.Pp 9315Extensive terminal-management capabilities. 9316See 9317.Va Terminal management 9318.Pp 9319New builtin commands including 9320.Va builtins 9321, 9322.Va hup 9323, \fIls\-F\fR, 9324.Va newgrp 9325, 9326.Va printenv 9327, 9328.Va which 9329and 9330.Va where 9331(q.v.). 9332.Pp 9333New variables that make useful information easily available to the shell. 9334See the 9335.Va gid 9336, 9337.Va loginsh 9338, 9339.Va oid 9340, 9341.Va shlvl 9342, 9343.Va tcsh 9344, 9345.Va tty 9346, 9347.Va uid 9348and 9349.Va version 9350shell variables and the 9351.Va HOST 9352, 9353.Va REMOTEHOST 9354, 9355.Va VENDOR 9356, 9357.Va OSTYPE 9358and 9359.Va MACHTYPE 9360environment 9361variables. 9362.Pp 9363A new syntax for including useful information in the prompt string 9364(see 9365.Va prompt 9366), 9367and special prompts for loops and spelling correction 9368(see 9369.Va prompt2 9370and 9371.Va prompt3 9372). 9373.Pp 9374Read-only variables. 9375See 9376.Va Variable substitution 9377.Sh BUGS 9378When a suspended command is restarted, the shell prints the directory 9379it started in if this is different from the current directory. 9380This can 9381be misleading (i.e., wrong) as the job may have changed directories internally. 9382.Pp 9383Shell builtin functions are not stoppable/restartable. 9384Command sequences 9385of the form 9386.Sq a ; b ; c 9387are also not handled gracefully when stopping is 9388attempted. 9389If you suspend 9390.Sq b 9391, the shell will then immediately execute 9392`c'. 9393This is especially noticeable if this expansion results from an 9394.Va alias 9395It suffices to place the sequence of commands in ()'s to force it 9396to a subshell, i.e., 9397.Sq ( a ; b ; c ) 9398.Pp 9399Control over tty output after processes are started is primitive; perhaps 9400this will inspire someone to work on a good virtual terminal interface. 9401In a virtual terminal interface much more interesting things could be 9402done with output control. 9403.Pp 9404Alias substitution is most often used to clumsily simulate shell procedures; 9405shell procedures should be provided rather than aliases. 9406.Pp 9407Control structures should be parsed rather than being recognized as 9408built-in commands. 9409This would allow control commands to be placed anywhere, 9410to be combined with 9411.Sq | 9412, and to be used with 9413.Sq & 9414and 9415.Sq ; 9416metasyntax. 9417.Pp 9418.Va foreach 9419doesn't ignore here documents when looking for its 9420.Va end 9421.Pp 9422It should be possible to use the 9423.Sq \&: 9424modifiers on the output of command 9425substitutions. 9426.Pp 9427The screen update for lines longer than the screen width is very poor 9428if the terminal cannot move the cursor up (i.e., terminal type 9429.Sq dumb 9430). 9431.Pp 9432.Va HPATH 9433and 9434.Va NOREBIND 9435don't need to be environment variables. 9436.Pp 9437Glob-patterns which do not use 9438.Sq \&? 9439, 9440.Sq * 9441or 9442.Sq [] 9443or which use 9444.Sq {} 9445or 9446.Sq ~ 9447are not negated correctly. 9448.Pp 9449The single-command form of 9450.Va if 9451does output redirection even if 9452the expression is false and the command is not executed. 9453.Pp 9454\fIls\-F\fR includes file identification characters when sorting filenames 9455and does not handle control characters in filenames well. 9456It cannot be 9457interrupted. 9458.Pp 9459Command substitution supports multiple commands and conditions, but not 9460cycles or backward 9461.Va goto 9462s. 9463.Pp 9464Report bugs at https://bugs.astron.com/, preferably with fixes. 9465If you want to 9466help maintain and test tcsh, add yourself to the mailing list in 9467https://mailman.astron.com/. 9468.Sq subscribe tcsh 9469on a line by itself in the body. 9470.Sh THE T IN TCSH 9471In 1964, DEC produced the PDP-6. 9472The PDP-10 was a later re-implementation. 9473It 9474was re-christened the DECsystem-10 in 1970 or so when DEC brought out the 9475second model, the KI10. 9476.Pp 9477TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts 9478think tank) in 94791972 as an experiment in demand-paged virtual memory operating systems. 9480They 9481built a new pager for the DEC PDP-10 and created the OS to go with it. 9482It was 9483extremely successful in academia. 9484.Pp 9485In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to 9486have only a version of TENEX, which they had licensed from BBN, for the new 9487box. 9488They called their version TOPS-20 (their capitalization is trademarked). 9489A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC 9490found themselves supporting two incompatible systems on the same hardware--but 9491then there were 6 on the PDP-11! 9492.Pp 9493TENEX, and TOPS-20 to version 3, had command completion 9494via a user-code-level subroutine library called ULTCMD. 9495With version 3, DEC 9496moved all that capability and more into the monitor (`kernel' for you Unix 9497types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the 9498supervisor call mechanism [are my IBM roots also showing?]). 9499.Pp 9500The creator of tcsh was impressed by this feature and several others of TENEX 9501and TOPS-20, and created a version of csh which mimicked them. 9502.Sh LIMITATIONS 9503The system limits argument lists to ARG_MAX characters. 9504.Pp 9505The number of arguments to a command which involves filename expansion is 9506limited to 1/6th the number of characters allowed in an argument list. 9507.Pp 9508Command substitutions may substitute no more characters than are allowed in 9509an argument list. 9510.Pp 9511To detect looping, the shell restricts the number of 9512.Va alias 9513substitutions on a single line to 20. 9514.Sh "SEE ALSO" 9515csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1), 9516tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2), 9517pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2), 9518malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7), 9519termio(7), Introduction to the C Shell 9520.Sh VERSION 9521This manual documents tcsh 6.21.00 (Astron) 2019-05-08. 9522.Sh AUTHORS 9523.PD 0 9524.TP 2 9525William Joy 9526Original author of 9527.Xr csh 1 9528.TP 2 9529J.E. Kulp, IIASA, Laxenburg, Austria 9530Job control and directory stack features 9531.TP 2 9532Ken Greer, HP Labs, 1981 9533File name completion 9534.TP 2 9535Mike Ellis, Fairchild, 1983 9536Command name recognition/completion 9537.TP 2 9538Paul Placeway, Ohio State CIS Dept., 1983-1993 9539Command line editor, prompt routines, new glob syntax and numerous fixes 9540and speedups 9541.TP 2 9542Karl Kleinpaste, CCI 1983-4 9543Special aliases, directory stack extraction stuff, login/logout watch, 9544scheduled events, and the idea of the new prompt format 9545.TP 2 9546Rayan Zachariassen, University of Toronto, 1984 9547\fIls\-F\fR and 9548.Va which 9549builtins and numerous bug fixes, modifications 9550and speedups 9551.TP 2 9552Chris Kingsley, Caltech 9553Fast storage allocator routines 9554.TP 2 9555Chris Grevstad, TRW, 1987 9556Incorporated 4.3BSD 9557.Xr csh 1 9558into 9559.Nm 9560.TP 2 9561Christos S. Zoulas, Cornell U. EE Dept., 1987-94 9562Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support 9563and a new version of sh.glob.c 9564.TP 2 9565James J Dempsey, BBN, and Paul Placeway, OSU, 1988 9566A/UX port 9567.TP 2 9568Daniel Long, NNSC, 1988 9569.Va wordchars 9570.TP 2 9571Patrick Wolfe, Kuck and Associates, Inc., 1988 9572.Va vi 9573mode cleanup 9574.TP 2 9575David C Lawrence, Rensselaer Polytechnic Institute, 1989 9576.Va autolist 9577and ambiguous completion listing 9578.TP 2 9579Alec Wolman, DEC, 1989 9580Newlines in the prompt 9581.TP 2 9582Matt Landau, BBN, 1989 9583.Va ~/.tcshrc 9584.TP 2 9585Ray Moody, Purdue Physics, 1989 9586Magic space bar history expansion 9587.TP 2 9588Mordechai ????, Intel, 1989 9589printprompt() fixes and additions 9590.TP 2 9591Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989 9592Automatic spelling correction and 9593.Va prompt3 9594.TP 2 9595Per Hedeland, Ellemtel, Sweden, 1990- 9596Various bugfixes, improvements and manual updates 9597.TP 2 9598Hans J. Albertsson (Sun Sweden) 9599.Va ampm 9600, 9601.Va settc 9602and 9603.Va telltc 9604.TP 2 9605Michael Bloom 9606Interrupt handling fixes 9607.TP 2 9608Michael Fine, Digital Equipment Corp 9609Extended key support 9610.TP 2 9611Eric Schnoebelen, Convex, 1990 9612Convex support, lots of 9613.Xr csh 1 9614bug fixes, 9615save and restore of directory stack 9616.TP 2 9617Ron Flax, Apple, 1990 9618A/UX 2.0 (re)port 9619.TP 2 9620Dan Oscarsson, LTH Sweden, 1990 9621NLS support and simulated NLS support for non NLS sites, fixes 9622.TP 2 9623Johan Widen, SICS Sweden, 1990 9624.Va shlvl 9625, Mach support, 9626.Va correct-line 9627, 8-bit printing 9628.TP 2 9629Matt Day, Sanyo Icon, 1990 9630POSIX termio support, SysV limit fixes 9631.TP 2 9632Jaap Vermeulen, Sequent, 1990-91 9633Vi mode fixes, expand-line, window change fixes, Symmetry port 9634.TP 2 9635Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991 9636.Va autolist 9637beeping options, modified the history search to search for 9638the whole string from the beginning of the line to the cursor. 9639.TP 2 9640Scott Krotz, Motorola, 1991 9641Minix port 9642.TP 2 9643David Dawes, Sydney U. Australia, Physics Dept., 1991 9644SVR4 job control fixes 9645.TP 2 9646Jose Sousa, Interactive Systems Corp., 1991 9647Extended 9648.Va vi 9649fixes and 9650.Va vi 9651delete command 9652.TP 2 9653Marc Horowitz, MIT, 1991 9654ANSIfication fixes, new exec hashing code, imake fixes, 9655.Va where 9656.TP 2 9657Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995 9658ETA and Pyramid port, Makefile and lint fixes, 9659.Va ignoreeof 9660=n addition, and 9661various other portability changes and bug fixes 9662.TP 2 9663Jeff Fink, 1992 9664.Va complete-word-fwd 9665and 9666.Va complete-word-back 9667.TP 2 9668Harry C. Pulley, 1992 9669Coherent port 9670.TP 2 9671Andy Phillips, Mullard Space Science Lab U.K., 1992 9672VMS-POSIX port 9673.TP 2 9674Beto Appleton, IBM Corp., 1992 9675Walking process group fixes, 9676.Xr csh 1 9677bug fixes, 9678POSIX file tests, POSIX SIGHUP 9679.TP 2 9680Scott Bolte, Cray Computer Corp., 1992 9681CSOS port 9682.TP 2 9683Kaveh R. Ghazi, Rutgers University, 1992 9684Tek, m88k, Titan and Masscomp ports and fixes. 9685Added autoconf support. 9686.TP 2 9687Mark Linderman, Cornell University, 1992 9688OS/2 port 9689.TP 2 9690Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992 9691Linux port 9692.TP 2 9693Tim P. Starrin, NASA Langley Research Center Operations, 1993 9694Read-only variables 9695.TP 2 9696Dave Schweisguth, Yale University, 1993-4 9697New man page and tcsh.man2html 9698.TP 2 9699Larry Schwimmer, Stanford University, 1993 9700AFS and HESIOD patches 9701.TP 2 9702Luke Mewburn, RMIT University, 1994-6 9703Enhanced directory printing in prompt, 9704added 9705.Va ellipsis 9706and 9707.Va rprompt 9708.TP 2 9709Edward Hutchins, Silicon Graphics Inc., 1996 9710Added implicit cd. 9711.TP 2 9712Martin Kraemer, 1997 9713Ported to Siemens Nixdorf EBCDIC machine 9714.TP 2 9715Amol Deshpande, Microsoft, 1997 9716Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library 9717and message catalog code to interface to Windows. 9718.TP 2 9719Taga Nayuta, 1998 9720Color ls additions. 9721.PD 9722.Pp 9723.Sh "THANKS TO" 9724Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig, 9725Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all 9726the other people at Ohio State for suggestions and encouragement 9727.Pp 9728All the people on the net, for putting up with, 9729reporting bugs in, and suggesting new additions to each and every version 9730.Pp 9731Richard M. Alderson III, for writing the 9732.Sq T in tcsh 9733section 9734