summaryrefslogblamecommitdiff
path: root/contrib/tcsh/tcsh.man.new
blob: cb82955db317b6325102c251f9ba7297ae7fc760 (plain) (tree)
1
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
   
































































                                                                              
               
          
                  



































































































































































































































































































































                                                                               
                           









                                                                          
                               
























































































































































































































































































                                                                               

                                                                            







































                                                                   
             












































































































































































































































































































































































                                                                             

                               
                                                                    

                          


                                                                     
      

                                                                
          
                                                              
   















































































































































































































































































































































































































































































































































































                                                                                                                   
   




































































































































































































































































































































































                                                                             
                         




































































































































































































                                                                              
                                                  

















                                       

               

                                  
         


             
             




                                       
               









































































































































































































































































































































































































































































































                                                                               
                                                 








































































































































































































































































































































































































                                                                              

                                           
                                                               
         
    
        

                                
        
                           
         


                         
        
                            
         


                         
        
             
        
            
        


                           
            
         
        
                                                  
        
                      
        
                                           
         


                   
              
















                               


               

                   
        
              
         
                                                          
        
               
         
                                                             
        
              
   







































































































































































































































































































































































































































































































































































                                                                               

                                      


                 
               


                 
          

                           




                           
                                                        












































                                     



                                      





















                            
                            





















                                      
            








                                                                                 
                  














                                                                



                                                                                                      








                                                                                                   
   

                            
                                                          
        





                                                               
        




                    
        




                    
        



                                                         
        


























                                    
        







                                                                
        













                       
        


                                                             
        








                                                                   
          

                                                                   


                             
                       
   


























                                                                                


                                            
    
       
         
       
      
       
         
       
       
       
               
       
              
       
            
            

                                                     
   





                                                                        
                            






                                                                       
         










                                         
           



                     

                   
                                         

              






                                            

                     


                             

           











































































                                                                

         


                 

                 










































                                                    
     






                                                                       
     





                                 
     




                                                                        
     



                                                                       
     









                                                                

        
       
     
                          
     
                                       
     
                                                           
     
           
     
                                                     
     
                     
     
         
     
                                                   
     
          
     
    
     
      
     
       
     
               
     
       
     


          
     


                                               
     
             
     
         
     






                
     
           



                       

                         

                                
   





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                        
                                                               
              

                                                                




















































                                                                              
                                                       



















































































































































































































                                                                              
.\"
.\" Copyright (c) 1980, 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" - Indent in multiples of 4, usually 8.
.\"
.\" - Use \` for literal back-quote (`).
.\"
.\" - Use \e for literal backslash (\).
.\"
.\" - Use \-, not -.
.\"
.\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
.\"
.\" - Refer to external commands in man page format, e.g., .Xr csh 1
.\" However, tcsh is .Nm , because this is the tcsh man page (and
.\" see the next note anyway).
.\"
.\" - Say .Sq the shell , not .Sq tcsh ,
.\" unless distinguishing between tcsh and csh.
.\"
.\" - Say .Sq shell variable / .Sq environment variable instead of
.\" .Sq variable and .Sq builtin command / .Sq editor command instead of
.\" .Sq builtin or .Sq command
.\"   unless the distinction is absolutely clear from context.
.\"
.\" - Use the simple present tense.
.\" .Sq The shell uses , not .Sq The shell will use
.\"
.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
.\"   etc. in the reference section should be mentioned in the appropriate
.\"   descriptive section, or at least in the reference-section description
.\"   of another command (or whatever) which is mentioned in a description
.\"   section. Remember to note OS-specific things in "OS variant support",
.\"   new features in NEW FEATURES and referenced external commands in SEE
.\"   ALSO.
.\"
.\" - tcsh.man2html depends heavily on the specific nroff commands used in the
.\"   man page when the script was written. Please stick closely to the style
.\"   used here if you can. In particular, please don't use nroff commands
.\"   which aren't already used herein.
.\"
.Dd May 8, 2019
.Dt TCSH 1
.Os Astron 6.21.00
.Sh NAME
.Nm tcsh
.Nd C shell with file name completion and command line editing
.Sh SYNOPSIS
.Nm
.Op Fl bcdefFimnqstvVxX
.Op Fl Dname Ns Op =value
.Op Ar arg ...
.Nm
.Fl l
.Ek
.Sh DESCRIPTION
.Nm
is an enhanced but completely compatible version of the Berkeley
UNIX C shell,
.Xr csh 1 .
It is a command language interpreter usable both as an interactive login
shell and a shell script command processor.
It includes a command-line editor (see
.Sx The command-line editor )
programmable word completion (see
.Sx Completion and listing )
spelling correction (see
.Sx Spelling correction ) ,
a history mechanism (see
.Sx History substitution ) ,
job control (see
.Sx Jobs )
and a C-like syntax.
The
.Sx NEW FEATURES
section describes major enhancements of
.Nm
over
.Xr csh 1 .
Throughout this manual, features of
.Nm
not found in most
.Xr csh 1
implementations
(specifically, the 4.4BSD one)
are labeled with
.Sq (+) ,
and features which are present in
.Xr csh 1
but not usually documented are labeled with
.Sq (u) .
.Bl -tag
.Ss Argument list processing
If the first argument (argument 0) to the shell is
.Sq \-
then it is a login shell.
A login shell can be also specified by invoking the shell with
the
.Fl l
flag as the only argument.
.Pp
The rest of the flag arguments are interpreted as follows:
.Bl -tag -width indent
.It Fl b
Forces a
.Dq break
from option processing, causing any
further shell arguments to be treated as non-option arguments.
The remaining arguments will not be interpreted as shell options.
This may be used to pass options to a shell script without confusion
or possible subterfuge.
The shell will not run a set-user ID script without this option.
.It Fl c
Commands are read from the following argument (which must be present, and
must be a single argument),
stored in the
.Va command
shell variable for reference, and executed.
Any remaining arguments are placed in the
.Va argv
shell variable.
.It Fl d
The shell loads the directory stack from
.Pa ~/.cshdirs
as described under
.Sx Startup and shutdown ,
whether or not it is a login shell. (+)
.It Fl Dname Ns Op =value
Sets the environment variable
.Va name
.Dv value .
(Domain/OS only) (+)
.It Fl e
The shell exits if any invoked command terminates abnormally or
yields a non-zero exit status.
.It Fl f
The shell does not load any resource or startup files, or perform any
command hashing, and thus starts faster.
.It Fl F
The shell uses
.Xr fork 2
instead of
.Xr vfork 2
to spawn processes. (+)
.It Fl i
The shell is interactive and prompts for its top-level input, even if
it appears to not be a terminal.
Shells are interactive without this option if
their inputs and outputs are terminals.
.It Fl l
The shell is a login shell.
Applicable only if
.Fl l
is the only
flag specified.
.It Fl m
The shell loads
.Pa ~/.tcshrc
even if it does not belong to the effective user.
Newer versions of
.Xr su 1
can pass
.Fl m
to the shell. (+)
.It Fl n
The shell parses commands but does not execute them.
This aids in debugging shell scripts.
.It Fl q
The shell accepts SIGQUIT (see
.Sx Signal handling )
and behaves when it is used under a debugger.
Job control is disabled. (u)
.It Fl s
Command input is taken from the standard input.
.It Fl t
The shell reads and executes a single line of input.
A
.Sq \e
may be used to
escape the newline at the end of this line and continue onto another line.
.It Fl v
Sets the
.Va verbose
shell variable, so that
command input is echoed after history substitution.
.It Fl x
Sets the
.Va echo
shell variable, so that commands are echoed
immediately before execution.
.It Fl V
Sets the
.Va verbose
shell variable even before executing
.Pa ~/.tcshrc .
.It Fl X
Is to
.Fl x
as
.Fl V
is to
.Fl v .
.TP 4
.It Fl \-help
Print a help message on the standard output and exit. (+)
.It Fl \-version
Print the version/platform/compilation options on the standard output and exit.
This information is also contained in the
.Va version
shell variable. (+)
.El
.Pp
After processing of flag arguments, if arguments remain but none of the
.Fl c ,
.Fl i ,
.Fl s ,
or
.Fl t
options were given, the first argument is taken as the name of a file of
commands, or
.Dq script ,
to be executed.
The shell opens this file and saves its name for possible
resubstitution by
.Sq $0 .
Because many systems use either the standard
version 6 or version 7 shells whose shell scripts are not compatible
with this shell, the shell uses such a
.Sq standard
shell to execute a script
whose first character is not a
.Sq # ,
i.e., that does not start with a
comment.
.Pp
Remaining arguments are placed in the
.Va argv
shell variable.
.Ss Startup and shutdown
A login shell begins by executing commands from the system files
.Pa /etc/csh.cshrc
and
.Pa /etc/csh.login .
It then executes commands from files in the user's
.Pa home
directory:
first
.Pa ~/.tcshrc (+)
or, if
.Pa ~/.tcshrc
is not found,
.Pa ~/.cshrc ,
then
.Pa ~/.history
(or the value of the
.Va histfile
shell variable), then
.Pa ~/.login ,
and finally
.Pa ~/.cshdirs
(or the value of the
.Va dirsfile
shell variable) (+).
The shell may read
.Pa /etc/csh.login
before instead of after
.Pa /etc/csh.cshrc ,
and
.Pa ~/.login
before instead of after
.Pa ~/.tcshrc
or
.Pa ~/.cshrc
and
.Pa ~/.history ,
if so compiled;
see the
.Va version
shell variable. (+)
.Pp
Non-login shells read only
.Pa /etc/csh.cshrc
and
.Pa ~/.tcshrc
or
.Pa ~/.cshrc
on startup.
.Pp
For examples of startup files, please consult:
.Lk http://tcshrc.sourceforge.net
.Pp
Commands like
.Xr stty 1
and
.Xr tset 1 ,
which need be run only once per login, usually go in one's
.Pa ~/.login
file.
Users who need to use the same set of files with both
.Xr csh 1
and
.Nm
can have only a
.Pa ~/.cshrc
which checks for the existence of the
.Va tcsh
shell variable (q.v.) before using
.Nm \-
specific commands,
or can have both a
.Pa ~/.cshrc
and a
.Pa ~/.tcshrc
which
.Ic sources
(see the builtin command)
.Pa ~/.cshrc .
The rest of this manual uses
.Pa ~/.tcshrc
to mean
.Pa ~/.tcshrc
or,
if
.Pa ~/.tcshrc
is not found,
.Pa ~/.cshrc .
.Pp
In the normal case, the shell begins reading commands from the terminal,
prompting with
.Sq >\~ .
(Processing of arguments and the use of the shell to
process files containing command scripts are described later.)
The shell repeatedly reads a line of command input, breaks it into words,
places it on the command history list, parses it and executes each command
in the line.
.Pp
One can log out by typing
.Sq ^D
on an empty line,
.Sq logout
or
.Sq login
or
via the shell's autologout mechanism (see the
.Va autologout
shell variable).
When a login shell terminates it sets the
.Va logout
shell variable to
.Sq normal
or
.Sq automatic
as appropriate, then executes commands from the files
.Pa /etc/csh.logout
and
.Pa ~/.logout .
The shell may drop DTR on logout
if so compiled; see the
.Va version
shell variable.
.Pp
The names of the system login and logout files vary from system to system for
compatibility with different
.Xr csh 1
variants; see
.Sx FILES .
.Ss Editing
We first describe
.Sx The command-line editor
The
.Sx Completion and listing
and
.Sx Spelling correction
sections describe two sets of functionality that are implemented as editor
commands but which deserve their own treatment.
Finally,
.Sx Editor commands
lists and describes
the editor commands specific to the shell and their default bindings.
.Ss The command-line editor (+)
Command-line input can be edited using key sequences much like those used in
.Xr emacs 1
or
.Xr vi 1 .
The editor is active only when the
.Va edit
shell variable is set, which it is by default in interactive shells.
The
.Ic bindkey
builtin can display and change key bindings.
.Xr emacs 1
style key bindings are used by default
(unless the shell was compiled otherwise; see the
.Va version
shell variable),
but
.Ic bindkey
can change the key bindings to
.Xr vi 1
style bindings en masse.
.Pp
The shell always binds the arrow keys (as defined in the
.Va TERMCAP
environment variable) to:
.Pp
.Bl -tag -width right -compact -offset indent
.It down
.Ic down-history
.It up
.Ic up-history
.It left
.Ic backward-char
.It right
.Ic forward-char
.El
.Pp
unless doing so would alter another single-character binding.
One can set the arrow key escape sequences to the empty string with
.Va settc
to prevent these bindings.
The ANSI/VT100 sequences for arrow keys are always bound.
.Pp
Other key bindings are, for the most part, what
.Xr emacs 1
and
.Xr vi 1
users would expect and can easily be displayed by
.Ic bindkey ,
so there
is no need to list them here.
Likewise,
.Ic bindkey
can list the editor
commands with a short description of each.
Certain key bindings have different behavior depending if
.Xr emacs 1
or
.Xr vi 1
style bindings are being used; see
.Va vimode
for more information.
.Pp
Note that editor commands do not have the same notion of a
.Dq word
as does the shell.
The editor delimits words with any non-alphanumeric characters not in
the shell variable
.Va wordchars ,
while the shell recognizes only whitespace
and some of the characters with special meanings to it, listed under
.Sx Lexical structure .
.Ss Completion and listing (+)
The shell is often able to complete words when given a unique abbreviation.
Type part of a word (for example
.Ic ls
.Pa /usr/lost )
and hit the tab key to run the
.Ic complete-word
editor command.
The shell completes the filename
.Pa /usr/lost
to
.Pa /usr/lost+found/ ,
replacing the incomplete word with the complete word in the input buffer.
(Note the terminal
.Sq / ;
completion adds a
.Sq /
to the end of completed directories and a space to the end of other completed
words, to speed typing and provide a visual indicator of successful completion.
The
.Va addsuffix
shell variable can be unset to prevent this.)
If no match is found (perhaps
.Pa /usr/lost+found
doesn't exist), the terminal bell rings.
If the word is already complete (perhaps there is a
.Pa /usr/lost
on your
system, or perhaps you were thinking too far ahead and typed the whole thing)
a
.Sq /
or space is added to the end if it isn't already there.
.Pp
Completion works anywhere in the line, not at just the end; completed
text pushes the rest of the line to the right.
Completion in the middle of a word
often results in leftover characters to the right of the cursor that need
to be deleted.
.Pp
Commands and variables can be completed in much the same way.
For example, typing
.Sq em[tab]
would complete
.Sq em
to
.Sq emacs
if
.Pa emacs
were the only command on your system beginning with
.Sq em .
Completion can find a command in any directory in
.Pa path
or if given a full pathname.
Typing
.Sq echo $ar[tab]
would complete
.Sq $ar
to
.Sq $argv
if no other variable began with
.Sq ar .
.Pp
The shell parses the input buffer to determine whether the word you want to
complete should be completed as a filename, command or variable.
The first word in the buffer and the first word following
.Sq \&; ,
.Sq | ,
.Sq |& ,
.Sq &&
or
.Sq ||
is considered to be a command.
A word beginning with
.Sq $
is considered to be a variable.
Anything else is a filename.
An empty line is
.Sq completed
as a filename.
.Pp
You can list the possible completions of a word at any time by typing
.Sq ^D
to run the
.Ic delete-char-or-list-or-eof
editor command.
The shell lists the possible completions using the
.Ic ls\-F
builtin (q.v.)
and reprints the prompt and unfinished command line, for example:
.Bd -literal -offset indent
> ls /usr/l[^D]
lbin/       lib/        local/      lost+found/
> ls /usr/l
.Ed
.Pp
If the
.Va autolist
shell variable is set, the shell lists the remaining
choices (if any) whenever completion fails:
.Bd -literal -offset indent
> set autolist
> nm /usr/lib/libt[tab]
libtermcap.a@ libtermlib.a@
> nm /usr/lib/libterm
.Ed
.Pp
If
.Va autolist
shell variable is set to
.Sq ambiguous ,
choices are listed only when
completion fails and adds no new characters to the word being completed.
.Pp
A filename to be completed can contain variables, your own or others' home
directories abbreviated with
.Sq ~
(see
.Sx Filename substitution )
and directory stack entries abbreviated with
.Sq =
(see
.Sx Directory stack substitution ) .
For example,
.Bd -literal -offset indent
> ls ~k[^D]
kahn    kas     kellogg
> ls ~ke[tab]
> ls ~kellogg/
.Ed
or
.Bd -literal -offset indent
> set local = /usr/local
> ls $lo[tab]
> ls $local/[^D]
bin/ etc/ lib/ man/ src/
> ls $local/
.Ed
.Pp
Note that variables can also be expanded explicitly with the
.Ic expand-variables
editor command.
.Pp
.Ic delete-char-or-list-or-eof
lists at only the end of the line;
in the middle of a line it deletes the character under the cursor and
on an empty line it logs one out or, if then
.Va ignoreeof
variable is set, does nothing.
.Sq M-^D ,
bound to the editor command
.Ic list-choices ,
lists completion
possibilities anywhere on a line, and
.Ic list-choices
(or any one of the
related editor commands that do or don't delete, list and/or log out,
listed under
.Ic delete-char-or-list-or-eof )
can be bound to
.Sq ^D
with the
.Ic bindkey
builtin command if so desired.
.Pp
The
.Ic complete-word-fwd
and
.Ic complete-word-back
editor commands
(not bound to any keys by default) can be used to cycle up and down through
the list of possible completions, replacing the current word with the next or
previous word in the list.
.Pp
The shell variable
.Va fignore
can be set to a list of suffixes to be ignored by completion.
Consider the following:
.Bd -literal -offset indent
> ls
Makefile        condiments.h~   main.o          side.c
README          main.c          meal            side.o
condiments.h    main.c~
> set fignore = (.o \e~)
> emacs ma[^D]
main.c   main.c~  main.o
> emacs ma[tab]
> emacs main.c
.Ed
.Pp
.Sq main.c~
and
.Sq main.o
are ignored by completion (but not listing),
because they end in suffixes in
.Va fignore .
Note that a
.Sq \e
was needed in front of
.Sq ~
to prevent it from being expanded to
.Va home
as described under
.Sx Filename substitution .
.Va fignore
is ignored if only one completion is possible.
.Pp
If the
.Va complete
shell variable is set to
.Sq enhance ,
completion 1) ignores case and 2) considers periods, hyphens and underscores
.Sq ( \&. ,
.Sq \&-
and
.Sq _ )
to be word separators and hyphens and underscores to be equivalent.
If you had the following files
.Bd -literal -offset indent
comp.lang.c      comp.lang.perl   comp.std.c++
comp.lang.c++    comp.std.c
.Ed
.Pp
and typed
.Sq mail \-f c.l.c[tab] ,
it would be completed to
.Sq mail \-f comp.lang.c ,
and
.Sq ^D
would list
.Sq comp.lang.c
and
.Sq comp.lang.c++ .
.Sq mail \-f c..c++[^D]
would list
.Sq comp.lang.c++
and
.Sq comp.std.c++ .
Typing
.Sq rm a\-\-file[^D]
in the following directory
.Bd -literal -offset indent
A_silly_file    a-hyphenated-file    another_silly_file
.Ed
.Pp
would list all three files, because case is ignored and hyphens and
underscores are equivalent.
Periods, however, are not equivalent to
hyphens or underscores.
.Pp
If the
.Va complete
shell variable is set to
.Sq Enhance ,
completion
ignores case and differences between a hyphen and an underscore word
separator only when the user types a lowercase character or a hyphen.
Entering an uppercase character or an underscore will not match the
corresponding lowercase character or hyphen word separator.
Typing
.Sq rm a\-\-file[^D]
in the directory of the previous example would
still list all three files, but typing
.Sq rm A\-\-file
would match only
.Sq A_silly_file
and typing
.Sq rm a__file[^D]
would match just
.Sq A_silly_file
and
.Sq another_silly_file
because the user explicitly used an uppercase
or an underscore character.
.Pp
Completion and listing are affected by several other shell variables:
.Va recexact
can be set to complete on the shortest possible unique
match, even if more typing might result in a longer match:
.Bd -literal -offset indent
> ls
fodder   foo      food     foonly
> set recexact
> rm fo[tab]
.Ed
.Pp
just beeps, because
.Sq fo
could expand to
.Sq fod
or
.Sq foo ,
but if we type another
.Sq o ,
.Bd -literal -offset indent
> rm foo[tab]
> rm foo
.Ed
.Pp
the completion completes on
.Sq foo ,
even though
.Sq food
and
.Sq foonly
also match.
.Va autoexpand
can be set to run the
.Ic expand-history
editor command
before each completion attempt,
.Va autocorrect
can be set to
spelling-correct the word to be completed (see
.Sx Spelling correction )
before each completion attempt and
.Va correct
can be set to complete commands automatically after one hits
.Sq return .
.Va matchbeep
can be set to make completion beep or not beep in a variety
of situations, and
.Va nobeep
can be set to never beep at all.
.Va nostat
can be set to a list of directories and/or patterns that
match directories to prevent the completion mechanism from
.Xr stat 2
ing
those directories.
.Va listmax
and
.Va listmaxrows
can be set to limit the number of items
and rows (respectively) that are listed without asking first.
.Va recognize_only_executables
can be set to make the shell list only
executables when listing commands, but it is quite slow.
.Pp
Finally, the
.Ic complete
builtin command can be used to tell the shell how
to complete words other than filenames, commands and variables.
Completion and listing do not work on glob-patterns (see
.Sx Filename substitution ) ,
but the
.Ic list-glob
and
.Ic expand-glob
editor commands perform
equivalent functions for glob-patterns.
.Ss Spelling correction (+)
The shell can sometimes correct the spelling of filenames, commands and
variable names as well as completing and listing them.
.Pp
Individual words can be spelling-corrected with the
.Ic spell-word
editor command (usually bound to M-s and M-S)
and the entire input buffer with
.Ic spell-line
(usually bound to M-$).
The
.Va correct
shell variable can be set to
.Dv cmd
to correct the command name or
.Dv all
to correct the entire line each time return is typed, and
.Va autocorrect
can be set to correct the word to be completed
before each completion attempt.
.Pp
When spelling correction is invoked in any of these ways and
the shell thinks that any part of the command line is misspelled,
it prompts with the corrected line:
.Bd -literal -offset indent
> set correct = cmd
> lz /usr/bin
CORRECT>ls /usr/bin (y|n|e|a)?
.Ed
.Pp
One can answer
.Sq y
or space to execute the corrected line,
.Sq e
to leave the uncorrected command in the input buffer,
.Sq a
to abort the command as if
.Sq ^C
had been hit, and
anything else to execute the original line unchanged.
.Pp
Spelling correction recognizes user-defined completions (see the
.Ic complete
builtin command).
If an input word in a position for
which a completion is defined resembles a word in the completion list,
spelling correction registers a misspelling and suggests the latter
word as a correction.
However, if the input word does not match any of
the possible completions for that position, spelling correction does
not register a misspelling.
.Pp
Like completion, spelling correction works anywhere in the line,
pushing the rest of the line to the right and possibly leaving
extra characters to the right of the cursor.
.Ss Editor commands (+)
.Ic bindkey
lists key bindings and
.Ic bindkey \-l
lists and briefly describes editor commands.
Only new or especially interesting editor commands are described here.
See
.Xr emacs 1
and
.Xr vi 1
for descriptions of each editor's key bindings.
.Pp
The character or characters to which each command is bound by default is
given in parentheses.
.Sq ^character
means a control character and
.Sq M-character
a meta character, typed as
.Sq escape-character
on terminals without a meta key.
Case counts, but commands that are bound
to letters by default are bound to both lower- and uppercase letters for
convenience.
.Bl -tag -width indent
.It Ic backward-char Ar (^B, left)
Move back a character.
Cursor behavior modified by
.Va vimode
.It Ic backward-delete-word Ar (M-^H, M-^?)
Cut from beginning of current word to cursor \- saved in cut buffer.
Word boundary behavior modified by
.Va vimode
.It Ic backward-word Ar (M-b, M-B)
Move to beginning of current word.
Word boundary and cursor behavior modified by
.Va vimode
.It Ic beginning-of-line Ar (^A, home)
Move to beginning of line.
Cursor behavior modified by
.Va vimode
.It Ic capitalize-word Ar (M-c, M-C)
Capitalize the characters from cursor to end of current word.
Word boundary behavior modified by
.Va vimode
.It Ic complete-word Ar (tab)
Completes a word as described under
.Sx Completion and listing
.It Ic complete-word-back Ar (not bound)
Like
.Ic complete-word-fwd ,
but steps up from the end of the list.
.It Ic complete-word-fwd Ar (not bound)
Replaces the current word with the first word in the list of possible
completions.
May be repeated to step down through the list.
At the end of the list, beeps and reverts to the incomplete word.
.It Ic complete-word-raw Ar (^X-tab)
Like
.Ic complete-word ,
but ignores user-defined completions.
.It Ic copy-prev-word Ar (M-^_)
Copies the previous word in the current line into the input buffer.
See also
.Ic insert-last-word
Word boundary behavior modified by
.Va vimode
.It Ic dabbrev-expand Ar (M-/)
Expands the current word to the most recent preceding one for which
the current is a leading substring, wrapping around the history list
(once) if necessary.
Repeating
.Ic dabbrev-expand
without any intervening typing
changes to the next previous word etc., skipping identical matches
much like
.Ic history-search-backward
does.
.It Ic delete-char Ar (not bound)
Deletes the character under the cursor.
See also
.Ic delete-char-or-list-or-eof
Cursor behavior modified by
.Va vimode
.It Ic delete-char-or-eof Ar (not bound)
Does
.Ic delete-char
if there is a character under the cursor or
.Ic end-of-file
on an empty line.
See also
.Ic delete-char-or-list-or-eof
Cursor behavior modified by
.Va vimode
.It Ic delete-char-or-list Ar (not bound)
Does
.Ic delete-char
if there is a character under the cursor
or
.Ic list-choices
at the end of the line.
See also
.Ic delete-char-or-list-or-eof
.It Ic delete-char-or-list-or-eof Ar (^D)
Does
.Ic delete-char
if there is a character under the cursor,
.Ic list-choices
at the end of the line or
.Ic end-of-file
on an empty line.
See also those three commands, each of which does only a single action, and
.Ic delete-char-or-eof ,
.Ic delete-char-or-list
and
.Ic list-or-eof ,
each of which does a different two out of the three.
.It Ic delete-word Ar (M-d, M-D)
Cut from cursor to end of current word \- save in cut buffer.
Word boundary behavior modified by
.Va vimode
.It Ic down-history Ar (down-arrow, ^N)
Like
.Ic up-history ,
but steps down, stopping at the original input line.
.It Ic downcase-word Ar (M-l, M-L)
Lowercase the characters from cursor to end of current word.
Word boundary behavior modified by
.Va vimode
.It Ic end-of-file Ar (not bound)
Signals an end of file, causing the shell to exit unless the
.Va ignoreeof
shell variable (q.v.) is set to prevent this.
See also
.Ic delete-char-or-list-or-eof
.It Ic end-of-line Ar (^E, end)
Move cursor to end of line.
Cursor behavior modified by
.Va vimode
.It Ic expand-history Ar (M-space)
Expands history substitutions in the current word.
See
.Sx History substitution
See also
.Ic magic-space ,
.Ic toggle-literal-history
and the
.Va autoexpand
shell variable.
.It Ic expand-glob Ar (^X-*)
Expands the glob-pattern to the left of the cursor.
See
.Sx Filename substitution
.It Ic expand-line Ar (not bound)
Like
.Ic expand-history ,
but expands history substitutions in each word in the input buffer.
.It Ic expand-variables Ar (^X-$)
Expands the variable to the left of the cursor.
See
.Sx Variable substitution
.It Ic forward-char Ar (^F, right)
Move forward one character.
Cursor behavior modified by
.Va vimode
.It Ic forward-word Ar (M-f, M-F)
Move forward to end of current word.
Word boundary and cursor behavior modified by
.Va vimode
.It Ic history-search-backward Ar (M-p, M-P)
Searches backwards through the history list for a command beginning with
the current contents of the input buffer up to the cursor and copies it
into the input buffer.
The search string may be a glob-pattern (see
.Sx Filename substitution )
containing
.Sq * ,
.Sq \&?  ,
.Sq []
or
.Sq {}
.Ic up-history
and
.Ic down-history
will proceed from the
appropriate point in the history list.
Emacs mode only.
See also
.Ic history-search-forward
and
.Ic i-search-back
.It Ic history-search-forward Ar (M-n, M-N)
Like
.Ic history-search-backward ,
but searches forward.
.It Ic i-search-back Ar (not bound)
Searches backward like
.Ic history-search-backward ,
copies the first match
into the input buffer with the cursor positioned at the end of the pattern,
and prompts with
.Sq bck:
and the first match.
Additional characters may be
typed to extend the search,
.Ic i-search-back
may be typed to continue
searching with the same pattern, wrapping around the history list if
necessary,
.Ic ( i-search-back
must be bound to a
single character for this to work) or one of the following special characters
may be typed:
.Pp
.Bl -tag -width indent -compact
.It ^W
Appends the rest of the word under the cursor to the search pattern.
.It delete
(or any character bound to
.Ic backward-delete-char )
Undoes the effect of the last character typed and deletes a character
from the search pattern if appropriate.
.It ^G
If the previous search was successful, aborts the entire search.
If not, goes back to the last successful search.
.It escape
Ends the search, leaving the current line in the input buffer.
.El
.Pp
Any other character not bound to
.Ic self-insert-command
terminates the
search, leaving the current line in the input buffer, and
is then interpreted as normal input.
In particular, a carriage return
causes the current line to be executed.
See also
.Ic i-search-fwd
and
.Ic history-search-backward
Word boundary behavior modified by
.Va vimode
.It Ic i-search-fwd Ar (not bound)
Like
.Ic i-search-back ,
but searches forward.
Word boundary behavior modified by
.Va vimode
.It Ic insert-last-word Ar (M-_)
Inserts the last word of the previous input line
.Sq ( \&!$ )
into the input buffer.
See also
.Ic copy-prev-word
.It Ic list-choices Ar (M-^D)
Lists completion possibilities as described under
.Sx Completion and listing
See also
.Ic delete-char-or-list-or-eof
and
.Ic list-choices-raw
.It Ic list-choices-raw Ar (^X-^D)
Like
.Ic list-choices ,
but ignores user-defined completions.
.It Ic list-glob Ar (^X-g, ^X-G)
Lists (via the
.Ic ls\-F
builtin) matches to the glob-pattern
(see
.Sx Filename substitution )
to the left of the cursor.
.It Ic list-or-eof Ar (not bound)
Does
.Ic list-choices
or
.Ic end-of-file
on an empty line.
See also
.Ic delete-char-or-list-or-eof
.It Ic magic-space Ar (not bound)
Expands history substitutions in the current line,
like
.Ic expand-history ,
and inserts a space.
.Ic magic-space
is designed to be bound to the space bar,
but is not bound by default.
.It Ic normalize-command Ar (^X-?)
Searches for the current word in PATH and, if it is found, replaces it with
the full path to the executable.
Special characters are quoted.
Aliases are
expanded and quoted but commands within aliases are not.
This command is
useful with commands that take commands as arguments, e.g.,
.Sq dbx
and
.Sq sh \-x
.It Ic normalize-path Ar (^X-n, ^X-N)
Expands the current word as described under the
.Sq expand
setting
of the
.Va symlinks
shell variable.
.It Ic overwrite-mode Ar (unbound)
Toggles between input and overwrite modes.
.It Ic run-fg-editor Ar (M-^Z)
Saves the current input line and
looks for a stopped job where the file name portion of its first word
is found in the
.Va editors
shell variable.
If
.Va editors
is not set, then the file name portion of the
.Va EDITOR
environment variable
.Sq ( ed
if unset)
and the
.Va VISUAL
environment variable
Sq ( vi
if unset)
will be used.
If such a job is found, it is restarted as if
.Sq fg %
.Ic job
had been typed.
This is used to toggle back and forth between an editor and
the shell easily.
Some people bind this command to
.Sq ^Z
so they
can do this even more easily.
.It Ic run-help Ar (M-h, M-H)
Searches for documentation on the current command, using the same notion of
.Sq current command
as the completion routines, and prints it.
There is no way
to use a pager;
.Ic run-help
is designed for short help files.
If the special alias
.Va helpcommand
is defined, it is run with the
command name as a sole argument.
Else,
documentation should be in a file named
.Sq command.help ,
.Sq command.1 ,
.Sq command.6 ,
.Sq command.8 ,
or
.Sq command ,
which should be in one
of the directories listed in the
.Va HPATH
environment variable.
If there is more than one help file only the first is printed.
.It Ic self-insert-command Ar (text characters)
In insert mode (the default), inserts the typed character into the input line after the character under the cursor.
In overwrite mode, replaces the character under the cursor with the typed character.
The input mode is normally preserved between lines, but the
.Va inputmode
shell variable can be set to
.Dv insert
or
.Dv overwrite
to put the
editor in that mode at the beginning of each line.
See also
.Ic overwrite-mode
.It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X)
Indicates that the following characters are part of a
multi-key sequence.
Binding a command to a multi-key sequence really creates
two bindings: the first character to
.Ic sequence-lead-in
and the
whole sequence to the command.
All sequences beginning with a character
bound to
.Ic sequence-lead-in
are effectively bound to
.Ic undefined-key
unless bound to another command.
.It Ic spell-line Ar (M-$)
Attempts to correct the spelling of each word in the input buffer, like
.Ic spell-word ,
but ignores words whose first character is one of
.Sq \- ,
.Sq \ ! ,
.Sq ^
or
.Sq % ,
or which contain
.Sq \e ,
.Sq *
or
.Sq \&? ,
to avoid problems with switches, substitutions and the like.
See
.Sx Spelling correction
.It Ic spell-word Ar (M-s, M-S)
Attempts to correct the spelling of the current word as described under
.Sx Spelling correction
Checks each component of a word which appears to be a pathname.
.It Ic toggle-literal-history Ar (M-r, M-R)
Expands or
.Sq unexpands
history substitutions in the input buffer.
See also
.Ic expand-history
and the
.Va autoexpand
shell variable.
.It Ic undefined-key Ar (any unbound key)
Beeps.
.It Ic up-history Ar (up-arrow, ^P)
Copies the previous entry in the history list into the input buffer.
If
.Va histlit
is set, uses the literal form of the entry.
May be repeated to step up through the history list, stopping at the top.
.It Ic upcase-word Ar (M-u, M-U)
Uppercase the characters from cursor to end of current word.
Word boundary behavior modified by
.Va vimode
.It Ic vi-beginning-of-next-word Ar (not bound)
Vi goto the beginning of next word.
Word boundary and cursor behavior modified by
.Va vimode
.It Ic vi-eword Ar (not bound)
Vi move to the end of the current word.
Word boundary behavior modified by
.Va vimode
.It Ic vi-search-back Ar (?)
Prompts with
.Sq \&?
for a search string (which may be a glob-pattern, as with
.Ic history-search-backward ),
searches for it and copies it into the input buffer.
The bell rings if no match is found.
Hitting return ends the search and leaves the last match in the input
buffer.
Hitting escape ends the search and executes the match.
.Ic vi
mode only.
.It Ic vi-search-fwd Ar (/)
Like
.Ic vi-search-back ,
but searches forward.
.It Ic which-command Ar (M-?)
Does a
.Ic which
(see the description of the builtin command) on the
first word of the input buffer.
.It Ic yank-pop Ar (M-y)
When executed immediately after a
.Ic yank
or another
.Ic yank-pop ,
replaces the yanked string with the next previous string from the
killring. This also has the effect of rotating the killring, such that
this string will be considered the most recently killed by a later
.Ic yank
command. Repeating
.Ic yank-pop
will cycle through the
killring any number of times.
.El
.Ss Lexical structure
The shell splits input lines into words at blanks and tabs.
The special
characters
.Sq \&& ,
.Sq | ,
.Sq \&; ,
.Sq < ,
.Sq > ,
.Sq \&( ,
and
.Sq \&)
and the doubled characters
.Sq && ,
.Sq || ,
.Sq <<
and
.Sq >>
are always separate words, whether or not they are
surrounded by whitespace.
.Pp
When the shell's input is not a terminal, the character
.Sq #
is taken to begin a
comment.
Each
.Sq #
and the rest of the input line on which it appears is
discarded before further parsing.
.Pp
A special character (including a blank or tab) may be prevented from having
its special meaning, and possibly made part of another word, by preceding it
with a backslash
.Sq ( \e )
or enclosing it in single
.Sq ( \&' ) ,
, double
.Sq ( \&" )
or
backward
.Sq ( \&` )
quotes.
When not otherwise quoted a newline preceded by a
.Sq \e
is equivalent to a blank, but inside quotes this sequence results in a
newline.
.Pp
Furthermore, all
.Sx Substitutions
(see below) except
.Sx History substitution
can be prevented by enclosing the strings (or parts of strings)
in which they appear with single quotes or by quoting the crucial character(s)
(e.g.,
.Sq $
or
.Sq \&`
for
.Sx Variable substitution
or
.Sx Command substitution
respectively)
with
.Sq \e
.Sx ( Alias substitution
is no exception: quoting in any way any
character of a word for which an
.Va alias
has been defined prevents
substitution of the alias.
The usual way of quoting an alias is to precede it
with a backslash.)
.Sx History substitution
is prevented by
backslashes but not by single quotes.
Strings quoted with double or backward
quotes undergo
.Sx Variable substitution
and
.Sx Command substitution ,
but other substitutions are prevented.
.Pp
Text inside single or double quotes becomes a single word (or part of one).
Metacharacters in these strings, including blanks and tabs, do not form
separate words.
Only in one special case (see
.Sx Command substitution
below) can a double-quoted string yield parts of more than one word;
single-quoted strings never do.
Backward quotes are special: they signal
.Sx Command substitution
(q.v.), which may result in more than one word.
.Pp
Quoting complex strings, particularly strings which themselves contain quoting
characters, can be confusing.
Remember that quotes need not be used as they are
in human writing!
It may be easier to quote not an entire string, but only
those parts of the string which need quoting, using different types of quoting
to do so if appropriate.
.Pp
The
.Va backslash_quote
shell variable (q.v.) can be set to make backslashes
always quote
.Sq \e ,
.Sq \&' ,
and
.Sq \&"
(+) This may make complex quoting tasks
easier, but it can cause syntax errors in
.Xr csh 1
scripts.
.Ss Substitutions
We now describe the various transformations the shell performs on the input in
the order in which they occur.
We note in passing the data structures involved
and the commands and variables which affect them.
Remember that substitutions
can be prevented by quoting as described under
.Sx Lexical structure .
.Ss History substitution
Each command, or
.Sq event ,
input from the terminal is saved in the history list.
The previous command is always saved, and the
.Va history
shell
variable can be set to a number to save that many commands.
The
.Va histdup
shell variable can be set to not save duplicate events or consecutive duplicate
events.
.Pp
Saved commands are numbered sequentially from 1 and stamped with the time.
It is not usually necessary to use event numbers, but the current event number
can be made part of the prompt by placing an
.Sq \&!
in the
.Va prompt
shell variable.
.Pp
The shell actually saves history in expanded and literal (unexpanded) forms.
If the
.Va histlit
shell variable is set, commands that display and store
history use the literal form.
.Pp
The
.Va history
builtin command can print, store in a file, restore
and clear the history list at any time,
and the
.Va savehist
and
.Va histfile
shell variables can be set to
store the history list automatically on logout and restore it on login.
.Pp
History substitutions introduce words from the history list into the input
stream, making it easy to repeat commands, repeat arguments of a previous
command in the current command, or fix spelling mistakes in the previous
command with little typing and a high degree of confidence.
.Pp
History substitutions begin with the character
.Sq \&!
They may begin anywhere in
the input stream, but they do not nest.
The
.Sq \&!
may be preceded by a
.Sq \e
to
prevent its special meaning; for convenience, a
.Sq \&!
is passed unchanged when it
is followed by a blank, tab, newline,
.Sq =
or
.Sq \&(
History substitutions also
occur when an input line begins with
.Sq ^
This special abbreviation will be
described later.
The characters used to signal history substitution 
.Sq ( \&!
and
.Sq ^ )
can be changed by setting the
.Va histchars
shell variable.
Any input
line which contains a history substitution is printed before it is executed.
.Pp
A history substitution may have an
.Sq event specification ,
which indicates the event from which words are to be taken, a
.Sq word designator ,
which selects particular words from the chosen event, and/or a
.Sq modifier ,
which manipulates the selected words.
.Pp
An event specification can be
.Pp
.Bl -tag -width XXXX -offset indent -compact
.It Ar n
A number, referring to a particular event
.It Ar \-n
An offset, referring to the event
.Ar n
before the current event
.It Ar #
The current event.
This should be used carefully in
.Xr csh 1 ,
where there is no check for recursion.
.Nm
allows 10 levels of recursion.
(+)
.It Ar \&!
The previous event (equivalent to
.Sq \-1 )
.It Ar s
The most recent event whose first word begins with the string
.Va s
.It Ar ?s?
The most recent event which contains the string
.Va s
The second
.Sq \&?
can be omitted if it is immediately followed by a newline.
.El
.Pp
For example, consider this bit of someone's history list:
.Bd -literal -offset indent
 9  8:30    nroff \-man wumpus.man
10  8:31    cp wumpus.man wumpus.man.old
11  8:36    vi wumpus.man
12  8:37    diff wumpus.man.old wumpus.man
.Ed
.Pp
The commands are shown with their event numbers and time stamps.
The current event, which we haven't typed in yet, is event 13.
.Sq !11
and
.Sq !\-2
refer to event 11.
.Sq \&!!
refers to the previous event, 12.
.Sq \&!!
can be abbreviated
.Sq \&!
if it is
followed by
.Sq \&: 
.Sq ( \&:
is described below).
.Sq !n
refers to event 9, which begins with
.Sq n
.Sq !?old?
also refers to event 12, which contains
.Sq old
Without word designators or modifiers history references simply expand to the
entire event, so we might type
.Sq !cp
to redo the copy command or
.Sq !!|more
if the
.Sq diff
output scrolled off the top of the screen.
.Pp
History references may be insulated from the surrounding text with braces if
necessary.
For example,
.Sq !vdoc
would look for a command beginning with
.Sq vdoc ,
and, in this example, not find one, but
.Sq !{v}doc
would expand
unambiguously to
.Sq vi wumpus.mandoc
Even in braces, history substitutions do not nest.
.Pp
(+) While
.Xr csh 1
expands, for example,
.Sq !3d
to event 3 with the
letter
.Sq d
appended to it,
.Nm
expands it to the last event beginning
with
.Sq 3d ;
only completely numeric arguments are treated as event numbers.
This makes it possible to recall events beginning with numbers.
To expand
.Sq !3d
as in
.Xr csh 1
say
.Sq !{3}d
.Pp
To select words from an event we can follow the event specification by a
.Sq \&:
and a designator for the desired words.
The words of an input line are
numbered from 0, the first (usually command) word being 0, the second word
(first argument) being 1, etc.
The basic word designators are:
.Pp
.Bl -tag -width XXXX -offset indent -compact
.It Ar 0
The first (command) word
.It Ar n
The
.Va n
th argument
.It Ar ^
The first argument, equivalent to
.Sq 1
.It Ar $
The last argument
.It Ar %
The word matched by an ?
.Va s
? search
.It Ar x\-y
A range of words
.It Ar \-y
Equivalent to
.Sq 0\-y
.It Ar *
Equivalent to
.Sq ^\-$ ,
but returns nothing if the event contains only 1 word
.It Ar x*
Equivalent to
.Sq x\-$
.It Ar x\-
Equivalent to
.Sq x* ,
but omitting the last word
.Sq ( $ )
.El
.Pp
Selected words are inserted into the command line separated by single blanks.
For example, the
.Sq diff
command in the previous example might have been
typed as
.Sq diff !!:1.old !!:1
(using
.Sq \&:1
to select the first argument
from the previous event) or
.Sq diff !\-2:2 !\-2:1
to select and swap the
arguments from the
.Sq cp
command.
If we didn't care about the order of the
`diff' we might have said
.Sq diff !\-2:1\-2
or simply
.Sq diff !\-2:*
The
.Sq cp
command might have been written
.Sq cp wumpus.man !#:1.old
, using
.Sq #
to refer to the current event.
`!n:\- hurkle.man' would reuse the first two words from the
.Sq nroff
command
to say
.Sq nroff \-man hurkle.man
.Pp
The
.Sq \&:
separating the event specification from the word designator can be
omitted if the argument selector begins with a
.Sq ^ ,
.Sq $ ,
.Sq * ,
.Sq %
or
.Sq \&-
For example, our
.Sq diff
command might have been
.Sq diff !!^.old !!^
or,
equivalently,
.Sq diff !!$.old !!$
However, if
.Sq \&!!
is abbreviated
.Sq \&!
,
an argument selector beginning with
.Sq \-
will be interpreted as an event
specification.
.Pp
A history reference may have a word designator but no event specification.
It then references the previous command.
Continuing our
.Sq diff
example, we could have said simply `diff
!^.old !^' or, to get the arguments in the opposite order, just
.Sq diff !*
.Pp
The word or words in a history reference can be edited, or
.Sq `modified
',
by following it with one or more modifiers, each preceded by a
.Sq \&: :
.Pp
.Bl -tag -width XXXXXX -offset indent -compact
.It Ar h
Remove a trailing pathname component, leaving the head.
.It Ar t
Remove all leading pathname components, leaving the tail.
.It Ar r
Remove a filename extension
.Sq .xxx ,
leaving the root name.
.It Ar e
Remove all but the extension.
.It Ar u
Uppercase the first lowercase letter.
.It Ar l
Lowercase the first uppercase letter.
.It Ar s/l/r/
Substitute
.Ar l
for
.Ar r
.Ar l
is simply a string like
.Ar r
, not a regular expression as in
the eponymous
.Xr ed 1
command.
Any character may be used as the delimiter in place of
.Sq / ;
a
.Sq \e
can be used to quote the delimiter inside
.Va l
and
.Va r
The character
.Sq &
in the
.Va r
is replaced by
.Va l ;
.Sq \e
also quotes
.Sq &
If
.Va l
is empty (
.Dq \& ) ,
the
.Va l
from a previous substitution or the
.Va s
from a previous search or event number in event specification is used.
The trailing delimiter may be omitted if it is immediately followed by a
newline.
.It Ar \&&
Repeat the previous substitution.
.It Ar g
Apply the following modifier once to each word.
.It Ar a (+)
Apply the following modifier as many times as possible to a single word.
.Sq a
and
.Sq g
can be used together to apply a modifier globally.
With the
.Sq s
modifier, only the patterns contained in the original word are
substituted, not patterns that contain any substitution result.
.It Ar p
Print the new command line but do not execute it.
.It Ar q
Quote the substituted words, preventing further substitutions.
.It Ar x
Like 
.Ar q ,
but break into words at blanks, tabs and newlines.
.El
.Pp
Modifiers are applied to only the first modifiable word (unless
.Sq g
is used).
It is an error for no word to be modifiable.
.Pp
For example, the
.Sq diff
command might have been written as `diff wumpus.man.old
!#^:r', using
.Sq \&:r
to remove
.Sq .old
from the first argument on the same line
(`!#^').
We could say
.Sq echo hello out there
, then
.Sq echo !*:u
to capitalize
`hello',
.Sq echo !*:au
to say it out loud, or
.Sq echo !*:agu
to really shout.
We might follow
.Sq mail \-s "I forgot my password" rot
with
.Sq !:s/rot/root
to
correct the spelling of
.Sq root
(but see
.Sx Spelling correction
for a
different approach).
.Pp
There is a special abbreviation for substitutions.
.Sq ^ ,
when it is the first character on an input line, is equivalent to
.Sq !:s^
Thus we might have said
.Sq ^rot^root
to make the spelling correction in the
previous example.
This is the only history substitution which does not explicitly begin with
.Sq \&!
.Pp
(+) In
.Xr csh 1
as such, only one modifier may be applied to each history
or variable expansion.
In
.Nm ,
more than one may be used, for example
.Bd -literal -offset indent
% mv wumpus.man /usr/man/man1/wumpus.1
% man !$:t:r
man wumpus
.Ed
.Pp
In
.Xr csh 1 ,
the result would be
.Sq wumpus.1:r
A substitution followed by a
colon may need to be insulated from it with braces:
.Bd -literal -offset indent
> mv a.out /usr/games/wumpus
> setenv PATH !$:h:$PATH
Bad ! modifier: $.
> setenv PATH !{\-2$:h}:$PATH
setenv PATH /usr/games:/bin:/usr/bin:.
.Ed
.Pp
The first attempt would succeed in
.Xr csh 1
but fails in
.Nm ,
because
.Nm
expects another modifier after the second colon
rather than
.Sq $
.Pp
Finally, history can be accessed through the editor as well as through
the substitutions just described.
The
.Ic up-
and
.Ic down-history ,
.Ic history-search-backward
and
.Va -forward ,
.Ic i-search-back
and
.Ic -fwd ,
.Ic vi-search-back
and
.Ic -fwd ,
.Ic copy-prev-word
and
.Ic insert-last-word
editor commands search for
events in the history list and copy them into the input buffer.
The
.Ic toggle-literal-history
editor command switches between the
expanded and literal forms of history lines in the input buffer.
.Ic expand-history
and
.Ic expand-line
expand history substitutions
in the current word and in the entire input buffer respectively.
.Ss Alias substitution
The shell maintains a list of aliases which can be set, unset and printed by
the
.Ic alias
and
.Ic unalias
commands.
After a command line is parsed
into simple commands (see
.Sx Commands )
the first word of each command,
left-to-right, is checked to see if it has an alias.
If so, the first word is
replaced by the alias.
If the alias contains a history reference, it undergoes
.Va History substitution
(q.v.) as though the original command were the
previous input line.
If the alias does not contain a history reference, the
argument list is left untouched.
.Pp
Thus if the alias for
.Sq ls
were
.Sq ls \-l
the command
.Sq ls /usr
would become `ls
\-l /usr', the argument list here being undisturbed.
If the alias for
.Sq lookup
were
.Sq grep !/etc/passwd
then
.Sq lookup bill
would become `grep bill
/etc/passwd'.
Aliases can be used to introduce parser metasyntax.
For
example,
.Sq alias print
pr \e!* | lpr'' defines a
.Sq `command
' (`print') which
.Va pr
(1)s its arguments to the line printer.
.Pp
Alias substitution is repeated until the first word of the command has no
alias.
If an alias substitution does not change the first word (as in the
previous example) it is flagged to prevent a loop.
Other loops are detected and
cause an error.
.Pp
Some aliases are referred to by the shell; see
.Va Special aliases
.Ss Variable substitution
The shell maintains a list of variables, each of which has as value a list of
zero or more words.
The values of shell variables can be displayed and changed with the
.Va set
and
.Va unset
commands.
The system maintains its own list of
.Sq `environment
' variables.
These can be displayed and changed with
.Va printenv
,
.Va setenv
and
.Va unsetenv
.Pp
(+) Variables may be made read-only with
.Sq set \-r
(q.v.).
Read-only variables may not be modified or unset;
attempting to do so will cause an error.
Once made read-only, a variable cannot be made writable,
so
.Sq set \-r
should be used with caution.
Environment variables cannot be made read-only.
.Pp
Some variables are set by the shell or referred to by it.
For instance, the
.Va argv
variable is an image of the shell's argument
list, and words of this variable's value are referred to in special ways.
Some of the variables referred to by the shell are toggles;
the shell does not care what their value is, only whether they are set or not.
For instance, the
.Va verbose
variable is a toggle which causes command
input to be echoed.
The
.Fl v\fR command line option sets this variable.
.Va Special shell variables
lists all variables which are referred to by the shell.
.Pp
Other operations treat variables numerically.
The
.Sq @
command permits numeric
calculations to be performed and the result assigned to a variable.
Variable
values are, however, always represented as (zero or more) strings.
For the
purposes of numeric operations, the null string is considered to be zero, and
the second and subsequent words of multi-word values are ignored.
.Pp
After the input line is aliased and parsed, and before each command is
executed, variable substitution is performed keyed by
.Sq $
characters.
This
expansion can be prevented by preceding the
.Sq $
with a
.Sq \e
except within
.Sq "
s
where it
.Va always
occurs, and within
.Sq
's where it
.Va never
occurs.
Strings quoted by
.Sq \`
are interpreted later (see
.Sx Command substitution
below) so
.Sq $
substitution does not occur there until later,
if at all.
A
.Sq $
is passed unchanged if followed by a blank, tab, or
end-of-line.
.Pp
Input/output redirections are recognized before variable expansion, and are
variable expanded separately.
Otherwise, the command name and entire argument
list are expanded together.
It is thus possible for the first (command) word
(to this point) to generate more than one word, the first of which becomes the
command name, and the rest of which become arguments.
.Pp
Unless enclosed in
.Sq "
or given the
.Sq \&:q
modifier the results of variable
substitution may eventually be command and filename substituted.
Within
.Sq "
, a
variable whose value consists of multiple words expands to a (portion of a)
single word, with the words of the variable's value separated by blanks.
When
the
.Sq \&:q
modifier is applied to a substitution the variable will expand to
multiple words with each word separated by a blank and quoted to prevent later
command or filename substitution.
.Pp
The following metasequences are provided for introducing variable values into
the shell input.
Except as noted, it is an error to reference a variable which
is not set.
.Pp
.Bl -tag -width XXXXXXXXXX -offset indent -compact
.PD 0
.It Ar $name
.It Ar ${name}
Substitutes the words of the value of variable
.Va name ,
each separated
by a blank.
Braces insulate
.Va name
from following characters which would
otherwise be part of it.
Shell variables have names consisting of
letters and digits starting with a letter.
The underscore character is
considered a letter.
If
.Va name
is not a shell variable, but is set in the
environment, then that value is returned (but some of the other forms
given below are not available in this case).
.It Ar $name[selector]
.It Ar ${name[selector]}
Substitutes only the selected words from the value of
.Va name
The
.Va selector
is subjected to
.Sq $
substitution and may consist of
a single number or two numbers separated by a
.Sq \&-
The first word of a variable's value is numbered
.Sq 1
If the first number of a range is omitted it defaults to
.Sq 1
If the last member of a range is omitted it defaults to
.Sq $#
.Va name
The
.Va selector
.Sq *
selects all words.
It is not an error for a range to be empty if the
second argument is omitted or in range.
.It Ar $0
Substitutes the name of the file from which command input
is being read.
An error occurs if the name is not known.
.It Ar $number
.It Ar ${number}
Equivalent to
.Sq $argv[number]
.It Ar $*
Equivalent to
.Sq $argv ,
which is equivalent to
.Sq $argv[*]
.El
.Pp
The
.Sq \&:
modifiers described under
.Sx History substitution ,
except for
.Sq \&:p ,
can be applied to the substitutions above.
More than one may be used.
(+)
Braces may be needed to insulate a variable substitution from a literal colon
just as with
.Sx History substitution
(q.v.); any modifiers must appear
within the braces.
.Pp
The following substitutions can not be modified with
.Sq \&:
modifiers.
.Pp
.Bl -tag -width XXXXXXXXXX -offset indent -compact
.It Ar $?name
.It Ar ${?name}
Substitutes the string
.Sq 1
if
.Va name
is set,
.Sq 0
if it is not.
.It Ar $?0
Substitutes
.Sq 1
if the current input filename is known,
.Sq 0
if it is not.
Always
.Sq 0
in interactive shells.
.It Ar $#name
.It Ar ${#name}
Substitutes the number of words in
.Va name
.It Ar $#
Equivalent to
.Sq $#argv
(+)
.It Ar $%name
.It Ar ${%name}
Substitutes the number of characters in
.Va name
(+)
.Pp
.It Ar $%number
.It Ar ${%number}
Substitutes the number of characters in
.Va $argv[number] .
(+)
.It Ar $?
Equivalent to
.Sq $status
(+)
.It Ar $$
Substitutes the (decimal) process number of the (parent) shell.
.It Ar $!
Substitutes the (decimal) process number of the last
background process started by this shell.
(+)
.It Ar $_
Substitutes the command line of the last command executed.
(+)
.It Ar $<
Substitutes a line from the standard input, with no further interpretation
thereafter.
It can be used to read from the keyboard in a shell script.
(+) While
.Xr csh 1
always quotes $<, as if it were equivalent to
.Sq $<:q ,
.Nm
does not.
Furthermore, when
.Nm
is waiting for a line to be
typed the user may type an interrupt to interrupt the sequence into
which the line is to be substituted, but
.Xr csh 1
does not allow this.
.El
.Pp
The editor command
.Va expand-variables
, normally bound to
.Sq ^X-$ ,
can be used to interactively expand individual variables.
.Ss "Command, filename and directory stack substitution"
The remaining substitutions are applied selectively to the arguments
of builtin commands.
This means that portions of expressions which are not evaluated are
not subjected to these expansions.
For commands which are not internal to the
shell, the command name is substituted separately from the argument list.
This occurs very late, after input-output redirection is performed, andk
in a child of the main shell.
.Ss "Command substitution"
Command substitution is indicated by a command enclosed in
.Sq \&`
The output
from such a command is broken into separate words at blanks, tabs and newlines,
and null words are discarded.
The output is variable and command substituted
and put in place of the original string.
.Pp
Command substitutions inside double
quotes
.Sq ( \&" )
retain blanks and tabs; only newlines force new words.
The single
final newline does not force a new word in any case.
It is thus possible for a
command substitution to yield only part of a word, even if the command outputs
a complete line.
.Pp
By default, the shell since version 6.12 replaces all newline and carriage
return characters in the command by spaces.
If this is switched off by
unsetting
.Va csubstnonl ,
newlines separate commands as usual.
.Ss "Filename substitution"
If a word contains any of the characters
.Sq * ,
.Sq \&? ,
.Sq \&[
or
.Sq {
or begins with
the character
.Sq ~
it is a candidate for filename substitution, also known as
.Dq globbing .
This word is then regarded as a pattern
.Dq ( glob-pattern ) ,
and
replaced with an alphabetically sorted list of file names which match the
pattern.
.Pp
In matching filenames, the character
.Sq .
at the beginning of a filename or
immediately following a
.Sq / ,
as well as the character
.Sq /
must be matched
explicitly (unless either
.Va globdot
or
.Va globstar
or both are set(+)).
The character
.Sq *
matches any string of characters,
including the null string.
The character
.Sq \&?
matches any single character.
The sequence
.Sq [...]
matches any one of the characters enclosed.
Within
.Sq [...]
, a pair of
characters separated by
.Sq \&-
matches any character lexically between the two.
.Pp
(+) Some glob-patterns can be negated:
The sequence
.Sq [^...]
matches any single character
.Va not
specified by the
characters and/or ranges of characters in the braces.
.Pp
An entire glob-pattern can also be negated with
.Sq ^ :
.Bd -literal -offset indent
> echo *
bang crash crunch ouch
> echo ^cr*
bang ouch
.Ed
.Pp
Glob-patterns which do not use
.Sq \&? ,
.Sq * , or
.Sq []
or which use
.Sq {}
or
.Sq ~
(below) are not negated correctly.
.Pp
The metanotation
.Sq a{b,c,d}e
is a shorthand for
.Sq abe ace ade
Left-to-right order is preserved:
.Sq /usr/source/s1/{oldls,ls}.c
expands
to
.Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c
The results of matches are
sorted separately at a low level to preserve this order:
.Sq ../{memo,*box}
might expand to
.Sq ../memo ../box ../mbox
(Note that
.Sq memo
was not sorted with the results of matching
.Sq *box . )
It is not an error when this construct expands to files which do not exist,
but it is possible to get an error from a command to which the expanded list
is passed.
This construct may be nested.
As a special case the words
.Sq { ,
.Sq }
and
.Sq {}
are passed undisturbed.
.Pp
The character
.Sq ~
at the beginning of a filename refers to home directories.
Standing alone, i.e.,
.Sq ~ ,
it expands to the invoker's home directory as
reflected in the value of the
.Va home
shell variable.
When followed by a
name consisting of letters, digits and
.Sq \&-
characters the shell searches for a
user with that name and substitutes their home directory; thus
.Sq ~ken
might
expand to
.Sq /usr/ken
and
.Sq ~ken/chmach
to
.Sq /usr/ken/chmach
If the character
.Sq ~
is followed by a character other than a letter or
.Sq /
or appears elsewhere
than at the beginning of a word, it is left undisturbed.
A command like
.Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man
does not,
therefore, do home directory substitution as one might hope.
.Pp
It is an error for a glob-pattern containing
.Sq * ,
.Sq \&?  ,
.Sq \&[
or
.Sq ~ ,
with or
without
.Sq ^ ,
not to match any files.
However, only one pattern in a list of
glob-patterns must match a file (so that, e.g.,
.Sq rm *.a *.c *.o
would fail
only if there were no files in the current directory ending in
.Sq .a ,
.Sq .c ,
or
.Sq .o ) ,
and if the
.Va nonomatch
shell variable is set a pattern (or list
of patterns) which matches nothing is left unchanged rather than causing
an error.
.Pp
The
.Va globstar
shell variable can be set to allow
.Sq **
or
.Sq ***
as
a file glob pattern that matches any string of characters including
.Sq / ,
recursively traversing any existing sub-directories.
For example,
.Sq ls **.c
will list all the .c files in the current directory tree.
If used by itself, it will match zero or more sub-directories
(e.g.
.Sq ls /usr/include/**/time.h
will list any file named
.Sq time.h
in the /usr/include directory tree;
.Sq ls /usr/include/**time.h
will match
any file in the /usr/include directory tree ending in
.Sq time.h ;
and
.Sq ls /usr/include/**time**.h
will match any .h file with
.Sq time
either
in a subdirectory name or in the filename itself).
To prevent problems with recursion, the
.Sq **
glob-pattern will not
descend into a symbolic link containing a directory.
To override this,
use
.Sq ***
(+)
.Pp
The
.Va noglob
shell variable can be set to prevent filename substitution,
and the
.Va expand-glob
editor command, normally bound to
.Sq ^X-* ,
can be
used to interactively expand individual filename substitutions.
.Ss "Directory stack substitution (+)"
The directory stack is a list of directories, numbered from zero, used by the
.Va pushd ,
.Va popd
and
.Va dirs
builtin commands (q.v.).
.Va dirs
can print, store in a file, restore and clear the directory stack
at any time, and the
.Va savedirs
and
.Va dirsfile
shell variables can be set to
store the directory stack automatically on logout and restore it on login.
The
.Va dirstack
shell variable can be examined to see the directory stack and
set to put arbitrary directories into the directory stack.
.Pp
The character
.Sq =
followed by one or more digits expands to an entry in
the directory stack.
The special case
.Sq =-
expands to the last directory in
the stack.
For example,
.Bd -literal -offset indent
> dirs \&-v
0       /usr/bin
1       /usr/spool/uucp
2       /usr/accts/sys
> echo =1
/usr/spool/uucp
> echo =0/calendar
/usr/bin/calendar
> echo =\-
/usr/accts/sys
.Ed
.Pp
The
.Va noglob
and
.Va nonomatch
shell variables and the
.Va expand-glob
editor command apply to directory stack as well as filename substitutions.
.Ss "Other substitutions (+)"
There are several more transformations involving filenames, not strictly
related to the above but mentioned here for completeness.
.Va Any
filename may be expanded to a full path when the
.Va symlinks
variable (q.v.) is set to
.Sq expand
Quoting prevents this expansion, and
the
.Va normalize-path
editor command does it on demand.
The
.Va normalize-command
editor command expands commands in PATH into
full paths on demand.
Finally,
.Va cd
and
.Va pushd
interpret
.Sq \&-
as the old working directory
(equivalent to the shell variable
.Va owd ) .
This is not a substitution at all, but an abbreviation recognized by only
those commands.
Nonetheless, it too can be prevented by quoting.
.Ss "Commands"
The next three sections describe how the shell executes commands and
deals with their input and output.
.Ss "Simple commands, pipelines and sequences"
A simple command is a sequence of words, the first of which specifies the
command to be executed.
A series of simple commands joined by
.Sq |
characters
forms a pipeline.
The output of each command in a pipeline is connected to the
input of the next.
.Pp
Simple commands and pipelines may be joined into sequences with
.Sq ; ,
and will
be executed sequentially.
Commands and pipelines can also be joined into
sequences with
.Sq ||
or
.Sq && ,
indicating, as in the C language, that the second
is to be executed only if the first fails or succeeds respectively.
.Pp
A simple command, pipeline or sequence may be placed in parentheses,
.Sq () ,
to form a simple command, which may in turn be a component of a pipeline or
sequence.
A command, pipeline or sequence can be executed
without waiting for it to terminate by following it with an
.Sq \&& .
.Ss "Builtin and non-builtin command execution"
Builtin commands are executed within the shell.
If any component of a
pipeline except the last is a builtin command, the pipeline is executed
in a subshell.
.Pp
Parenthesized commands are always executed in a subshell.
.Bd -literal -offset indent
(cd; pwd); pwd
.Ed
.Pp
thus prints the
.Va home
directory, leaving you where you were
(printing this after the home directory), while
.Bd -literal -offset indent
cd; pwd
.Ed
.Pp
leaves you in the
.Va home
directory.
Parenthesized commands are most often
used to prevent
.Va cd
from affecting the current shell.
.Pp
When a command to be executed is found not to be a builtin command the shell
attempts to execute the command via
.Xr execve 2 .
Each word in the variable
.Va path
names a directory in which the shell will look for the
command.
If the shell is not given a
.Fl f
option, the shell
hashes the names in these directories into an internal table so that it will
try an
.Xr execve 2
in only a directory where there is a possibility that the
command resides there.
This greatly speeds command location when a large
number of directories are present in the search path. This hashing mechanism is
not used:
.TP 4
.Bl -enum -width indent
.It
If hashing is turned explicitly off via
.Va unhash
.It
If the shell was given a
.Fl f Ar argument
.It 
For each directory component of
.Va path
which does not begin with a
.Sq /
.It
If the command contains a
.Sq /
.El
.Pp
In the above four cases the shell concatenates each component of the path
vector with the given command name to form a path name of a file which it
then attempts to execute it. If execution is successful, the search stops.
.Pp
If the file has execute permissions but is not an executable to the system
(i.e., it is neither an executable binary nor a script that specifies its
interpreter), then it is assumed to be a file containing shell commands and
a new shell is spawned to read it.
The
.Va shell
special alias may be set
to specify an interpreter other than the shell itself.
.Pp
On systems which do not understand the
.Sq #!
script interpreter convention
the shell may be compiled to emulate it; see the
.Va version
shell
variable.
If so, the shell checks the first line of the file to
see if it is of the form
.Sq #!interpreter arg ...
If it is,
the shell starts
.Va interpreter
with the given
.Va arg
s and feeds the
file to it on standard input.
.Ss "Input/output"
The standard input and standard output of a command may be redirected with the
following syntax:
.Pp
.Bl -tag -width XXXXXXXXX -offset indent -compact
.It Ar < name
Open file
.Va name
(which is first variable, command and filename
expanded) as the standard input.
.It Ar << word
Read the shell input up to a line which is identical to
.Va word .
.Va word
is not subjected to variable, filename or command substitution, and each input
line is compared to
.Va word
before any substitutions are done on this input
line.
Unless a quoting
.Sq \e ,
.Sq \&"
,
.Sq \&'
or
.Sq \&`
appears in
.Va word
variable and
command substitution is performed on the intervening lines, allowing
.Sq \e
to
quote
.Sq $ ,
.Sq \e
and
.Sq \&` .
Commands which are substituted have all blanks, tabs,
and newlines preserved, except for the final newline which is dropped.
The
resultant text is placed in an anonymous temporary file which is given to the
command as standard input.
.Pp
.It Ar > name
.It Ar >! name
.It Ar >& name
.It Ar >&! name
The file
.Va name
is used as standard output.
If the file does not exist
then it is created; if the file exists, it is truncated, its previous contents
being lost.
.Pp
If the shell variable
.Va noclobber
is set, then the file must not exist or be a
character special file (e.g., a terminal or
.Sq /dev/null )
or an error results.
This helps prevent accidental destruction of files.
In this case the
.Sq \&!
forms
can be used to suppress this check.
If
.Va notempty
is given in
.Va noclobber ,
.Sq >
is allowed on empty files;
if
.Va ask
is set, an interacive confirmation is presented, rather than an
error.
.Pp
The forms involving
.Sq \&&
route the diagnostic output into the specified file as
well as the standard output.
.Va name
is expanded in the same way as
.Sq <
input filenames are.
.Pp
.It Ar >> name
.It Ar >>& name
.It Ar >>! name
.It Ar >>&! name
Like
.Sq >
, but appends output to the end of
.Va name
If the shell variable
.Va noclobber
is set, then it is an error for
the file
.Va not
to exist, unless one of the
.Sq \&!
forms is given.
.El
.Pp
A command receives the environment in which the shell was invoked as modified
by the input-output parameters and the presence of the command in a pipeline.
Thus, unlike some previous shells, commands run from a file of shell commands
have no access to the text of the commands by default; rather they receive the
original standard input of the shell.
The
.Sq <<
mechanism should be used to
present inline data.
This permits shell command scripts to function as
components of pipelines and allows the shell to block read its input.
Note
that the default standard input for a command run detached is
.Va not
the empty file
.Va /dev/null ,
but the original standard input of the shell.
If this is a terminal and if the process attempts to read from the terminal,
then the process will block and the user will be notified (see
.Sx Jobs ) .
.Pp
Diagnostic output may be directed through a pipe with the standard output.
Simply use the form
.Sq |&
rather than just
.Sq | .
.Pp
The shell cannot presently redirect diagnostic output without also redirecting
standard output, but
.Sq \&( command > output-file ) >&  error-file
is often an acceptable workaround.
Either
.Va output-file
or
.Va error-file
may be
.Sq /dev/tty
to send output to the terminal.
.Ss "Features"
Having described how the shell accepts, parses and executes
command lines, we now turn to a variety of its useful features.
.Ss "Control flow"
The shell contains a number of commands which can be used to regulate the
flow of control in command files (shell scripts) and (in limited but
useful ways) from terminal input.
These commands all operate by forcing the
shell to reread or skip in its input and, due to the implementation,
restrict the placement of some of the commands.
.Pp
The
.Va foreach ,
.Va switch ,
and
.Va while
statements, as well as the
.Va if-then-else
form of the
.Va if
statement, require that the major
keywords appear in a single simple command on an input line as shown below.
.Pp
If the shell's input is not seekable, the shell buffers up input whenever
a loop is being read and performs seeks in this internal buffer to
accomplish the rereading implied by the loop.
(To the extent that this allows, backward
.Va goto
s will succeed on non-seekable inputs.)
.Ss "Expressions"
The
.Va if ,
.Va while
and
.Va exit
builtin commands
use expressions with a common syntax.
The expressions can include any
of the operators described in the next three sections.
Note that the
.Va @
builtin command (q.v.) has its own separate syntax.
.Ss "Logical, arithmetical and comparison operators"
These operators are similar to those of C and have the same precedence.
They include
.IP "" 4
.Bl -tag -width XXXXXX -offset indent -compact
.It ||  &&  |   &  ==  !=  =~  !~  <=  >=
.It <  > <<  >>  +  \-  *  /  %  !  ~  (  )
.El
.Pp
Here the precedence increases to the right,
.Sq ==
.Sq \&!=
.Sq =~
and
.Sq \&!~ ,
.Sq <=
.Sq >=
.Sq <
and
.Sq > ,
.Sq <<
.Sq >> ,
.Sq +
and
.Sq \&- ,
.Sq *
.Sq /
and
.Sq %
being, in
groups, at the same level.
The
.Sq ==
.Sq \&!=
.Sq =~
and
.Sq \&!~
operators compare
their arguments as strings; all others operate on numbers.
The operators
.Sq =~
and
.Sq \&!~
are like
.Sq \&!=
and
.Sq ==
except that the right hand side is a
glob-pattern (see
.Sx Filename substitution )
against which the left hand operand is matched.
This reduces the need for use of the
.Va switch
builtin command in shell scripts when all that is really needed is
pattern matching.
.Pp
Null or
missing arguments are considered
.Sq 0
The results of all expressions are
strings, which represent decimal numbers.
It is important to note that
no two components of an expression can appear in the same word; except
when adjacent to components of expressions which are syntactically
significant to the parser
.Sq ( \&&
.Sq |
.Sq <
.Sq >
.Sq \&(
.Sq \&) )
they should be
surrounded by spaces.
.Ss "Command exit status"
Commands can be executed in expressions and their exit status
returned by enclosing them in braces 
.Sq ( {} ) .
Remember that the braces should
be separated from the words of the command by spaces.
Command executions
succeed, returning true, i.e.,
.Sq 1 ,
if the command exits with status 0,
otherwise they fail, returning false, i.e.,
.Sq 0 .
If more detailed status
information is required then the command should be executed outside of an
expression and the
.Va status
shell variable examined.
.Ss "File inquiry operators"
Some of these operators perform true/false tests on files and related
objects.
They are of the form
.Fl
.Va op file
, where
.Va op
is one of
.Bl -tag -width XXX -offset indent -compact
.It Ar r
Read access
.It Ar w
Write access
.It Ar x
Execute access
.It Ar X
Executable in the path or shell builtin, e.g.,
.Sq \&-X ls
and
.Sq \&-X ls\&-F
are
generally true, but
.Sq \&-X /bin/ls
is not (+)
.It Ar e
Existence
.It Ar o
Ownership
.It Ar z
Zero size
.It Ar s
Non-zero size (+)
.It Ar f
Plain file
.It Ar d
Directory
.It Ar l
Symbolic link (+) *
.It Ar b
Block special file (+)
.It Ar c
Character special file (+)
.It Ar p
Named pipe (fifo) (+) *
.It Ar S
Socket special file (+) *
.It Ar u
Set-user-ID bit is set (+)
.It Ar g
Set-group-ID bit is set (+)
.It Ar k
Sticky bit is set (+)
.It Ar t file
(which must be a digit) is an open file descriptor
for a terminal device (+)
.It Ar R
Has been migrated (Convex only) (+)
.It Ar L
Applies subsequent operators in a multiple-operator test to a symbolic link
rather than to the file to which the link points (+) *
.El
.Pp
.Va file
is command and filename expanded and then tested to
see if it has the specified relationship to the real user.
If
.Va file
does not exist or is inaccessible or, for the operators indicated by
.Sq * ,
if the specified file type does not exist on the current system,
then all inquiries return false, i.e.,
.Sq 0 .
.Pp
These operators may be combined for conciseness:
.Sq \&-
.Va xy file
is
equivalent to
.Sq \&-x file && \&-y file .
(+) For example,
.Sq \&-fx
is true
(returns
.Sq 1 )
for plain executable files, but not for directories.
.Pp
.Va L
may be used in a multiple-operator test to apply subsequent operators
to a symbolic link rather than to the file to which the link points.
For example,
.Sq \&-lLo
is true for links owned by the invoking user.
.Va Lr ,
.Va Lw
and
.Va Lx
are always true for links and false for
non-links.
.Va L
has a different meaning when it is the last operator
in a multiple-operator test; see below.
.Pp
It is possible but not useful, and sometimes misleading, to combine operators
which expect
.Va file
to be a file with operators which do not
(e.g.,
.Va X
and
.Va t ) .
Following
.Va L
with a non-file operator
can lead to particularly strange results.
.Pp
Other operators return other information, i.e., not just
.Sq 0
or
.Sq 1
(+)
They have the same format as before;
.Va op
may be one of
.Pp
.Bl -tag -width XXX -offset indent -compact
.It Ar A
Last file access time, as the number of seconds since the epoch
.It Ar A:
Like
.Va Ar A
, but in timestamp format, e.g.,
.Sq Fri May 14 16:36:10 1993
.It Ar M
Last file modification time
.It Ar M:
Like
.Va M
, but in timestamp format
.It Ar C
Last inode modification time
.It Ar C:
Like
.Va C
, but in timestamp format
.It Ar D
Device number
.It Ar I
Inode number
.It Ar F
Composite
.Va f
ile identifier, in the form
.Va device :
.Va inode
.It Ar L
The name of the file pointed to by a symbolic link
.It Ar N
Number of (hard) links
.It Ar P
Permissions, in octal, without leading zero
.It Ar P:
Like
.Va P
, with leading zero
.It Ar P<mode>
Equivalent to
.Sq \-P
.Va file
&
.Va mode
, e.g.,
.Sq \-P22
.Va file
returns
`22' if
.Va file
is writable by group and other,
.Sq 20
if by group only,
and
.Sq 0
if by neither
.It Ar P<mode>:
Like 
.Ar BP
.Va mode
, with leading zero
.It Ar U
Numeric userid
.It Ar U:
Username, or the numeric userid if the username is unknown
.It Ar G
Numeric groupid
.It Ar G:
Groupname, or the numeric groupid if the groupname is unknown
.It Ar Z
Size, in bytes
.El
.Pp
Only one of these operators may appear in a multiple-operator test, and it
must be the last.
Note that
.Va L
has a different meaning at the end of and
elsewhere in a multiple-operator test.
Because
.Sq 0
is a valid return value
for many of these operators, they do not return
.Sq 0
when they fail: most
return
.Sq \&-1
, and
.Va F
returns
.Sq \&:
.Pp
If the shell is compiled with POSIX defined (see the
.Va version
shell
variable), the result of a file inquiry is based on the permission bits of
the file and not on the result of the
.Va access
(2) system call.
For example, if one tests a file with
.Fl w\fR whose permissions would
ordinarily allow writing but which is on a file system mounted read-only,
the test will succeed in a POSIX shell but fail in a non-POSIX shell.
.Pp
File inquiry operators can also be evaluated with the
.Va filetest
builtin
command (q.v.) (+).
.Ss Jobs
The shell associates a
.Va job
with each pipeline.
It keeps a table of
current jobs, printed by the
.Va jobs
command, and assigns them small integer
numbers.
When a job is started asynchronously with
.Sq &
, the shell prints a
line which looks like
.IP "" 4
[1] 1234
.Pp
indicating that the job which was started asynchronously was job number 1 and
had one (top-level) process, whose process id was 1234.
.Pp
If you are running a job and wish to do something else you may hit the suspend
key (usually
.Sq ^Z ) ,
which sends a STOP signal to the current job.
The shell will then normally
indicate that the job has been
.Sq Suspended
and print another prompt.
If the
.Va listjobs
shell variable is set, all jobs will be listed
like the
.Va jobs
builtin command; if it is set to
.Sq long
the listing will
be in long format, like
.Sq jobs \&-l
You can then manipulate the state of the suspended job.
You can put it in the
.Dq background
 with the
.Va bg
command or run some other commands and
eventually bring the job back into the
.Sq foreground
' with
.Va fg
(See also the
.Va run-fg-editor
editor command.)
A
.Sq ^Z
takes effect immediately and is like an interrupt
in that pending output and unread input are discarded when it is typed.
The
.Va wait
builtin command causes the shell to wait for all background
jobs to complete.
.Pp
The
.Sq ^]
key sends a delayed suspend signal, which does not generate a STOP
signal until a program attempts to
.Va read
(2) it, to the current job.
This can usefully be typed ahead when you have prepared some commands for a
job which you wish to stop after it has read them.
The
.Sq ^Y
key performs this function in
.Xr csh 1
; in
.Nm
,
`^Y' is an editing command.
(+)
.Pp
A job being run in the background stops if it tries to read from the
terminal.
Background jobs are normally allowed to produce output, but this can
be disabled by giving the command
.Sq stty tostop
If you set this tty option,
then background jobs will stop when they try to produce output like they do
when they try to read input.
.Pp
There are several ways to refer to jobs in the shell.
The character
.Sq %
introduces a job name.
If you wish to refer to job number 1, you can name it
as
.Sq %1
Just naming a job brings it to the foreground; thus
.Sq %1
is a synonym
for
.Sq fg %1
, bringing job 1 back into the foreground.
Similarly, saying
.Sq %1 &
resumes job 1 in the background, just like
.Sq bg %1
A job can also be named
by an unambiguous prefix of the string typed in to start it:
.Sq %ex
would
normally restart a suspended
.Va ex
(1) job, if there were only one suspended
job whose name began with the string
.Sq ex
It is also possible to say
`%?
.Va string
' to specify a job whose text contains
.Va string
, if there
is only one such job.
.Pp
The shell maintains a notion of the current and previous jobs.
In output
pertaining to jobs, the current job is marked with a
.Sq +
and the previous job
with a
.Sq \-
The abbreviations
.Sq %+
,
.Sq %
, and (by analogy with the syntax of
the
.Va history
mechanism)
.Sq %%
all refer to the current job, and
.Sq %\-
refers
to the previous job.
.Pp
The job control mechanism requires that the
.Va stty
(1) option
.Sq new
be set
on some systems.
It is an artifact from a
.Sq new
implementation of the tty
driver which allows generation of interrupt characters from the keyboard to
tell jobs to stop.
See
.Va stty
(1) and the
.Va setty
builtin command for
details on setting options in the new tty driver.
.Ss "Status reporting"
The shell learns immediately whenever a process changes state.
It normally
informs you whenever a job becomes blocked so that no further progress is
possible, but only right before it prints a prompt.
This is done so that it
does not otherwise disturb your work.
If, however, you set the shell variable
.Va notify
, the shell will notify you immediately of changes of status in
background jobs.
There is also a shell command
.Va notify
which marks a
single process so that its status changes will be immediately reported.
By
default
.Va notify
marks the current process; simply say
.Sq notify
after
starting a background job to mark it.
.Pp
When you try to leave the shell while jobs are stopped, you will be
warned that
.Sq There are suspended jobs.
You may use the
.Va jobs
command to
see what they are.
If you do this or immediately try to exit again, the shell
will not warn you a second time, and the suspended jobs will be terminated.
.Ss "Automatic, periodic and timed events (+)"
There are various ways to run commands and take other actions automatically
at various times in the
.Sq `life cycle
' of the shell.
They are summarized here,
and described in detail under the appropriate
.Va Builtin commands
,
.Va Special shell variables
and
.Va Special aliases
.Pp
The
.Va sched
builtin command puts commands in a scheduled-event list,
to be executed by the shell at a given time.
.Pp
The
.Va beepcmd
,
.Va cwdcmd
,
.Va periodic
,
.Va precmd
,
.Va postcmd
,
and
.Va jobcmd
.Va Special aliases
can be set, respectively, to execute commands when the shell wants
to ring the bell, when the working directory changes, every
.Va tperiod
minutes, before each prompt, before each command gets executed, after each
command gets executed, and when a job is started or is brought into the
foreground.
.Pp
The
.Va autologout
shell variable can be set to log out or lock the shell
after a given number of minutes of inactivity.
.Pp
The
.Va mail
shell variable can be set to check for new mail periodically.
.Pp
The
.Va printexitvalue
shell variable can be set to print the exit status
of commands which exit with a status other than zero.
.Pp
The
.Va rmstar
shell variable can be set to ask the user, when
.Sq rm *
is
typed, if that is really what was meant.
.Pp
The
.Va time
shell variable can be set to execute the
.Va time
builtin
command after the completion of any process that takes more than a given
number of CPU seconds.
.Pp
The
.Va watch
and
.Va who
shell variables can be set to report when
selected users log in or out, and the
.Va log
builtin command reports
on those users at any time.
.Ss "Native Language System support (+)"
The shell is eight bit clean
(if so compiled; see the
.Va version
shell variable)
and thus supports character sets needing this capability.
NLS support differs depending on whether or not
the shell was compiled to use the system's NLS (again, see
.Va version
).
In either case, 7-bit ASCII is the default character code
(e.g., the classification of which characters are printable) and sorting,
and changing the
.Va LANG
or
.Va LC_CTYPE
environment variables
causes a check for possible changes in these respects.
.Pp
When using the system's NLS, the
.Va setlocale
(3) function is called
to determine appropriate character code/classification and sorting
(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
This function typically examines the
.Va LANG
and
.Va LC_CTYPE
environment variables; refer to the system documentation for further details.
When not using the system's NLS, the shell simulates it by assuming that the
ISO 8859-1 character set is used
whenever either of the
.Va LANG
and
.Va LC_CTYPE
variables are set, regardless of
their values.
Sorting is not affected for the simulated NLS.
.Pp
In addition, with both real and simulated NLS, all printable
characters in the range \e200\-\e377, i.e., those that have
M-
.Va char
bindings, are automatically rebound to
.Va self-insert-command
The corresponding binding for the escape-
.Va char
sequence, if any, is
left alone.
These characters are not rebound if the
.Va NOREBIND
environment variable
is set.
This may be useful for the simulated NLS or a primitive real NLS
which assumes full ISO 8859-1.
Otherwise, all M-
.Va char
bindings in the
range \e240\-\e377 are effectively undone.
Explicitly rebinding the relevant keys with
.Va bindkey
is of course still possible.
.Pp
Unknown characters (i.e., those that are neither printable nor control
characters) are printed in the format \ennn.
If the tty is not in 8 bit mode, other 8 bit characters are printed by
converting them to ASCII and using standout mode.
The shell
never changes the 7/8 bit mode of the tty and tracks user-initiated
changes of 7/8 bit mode.
NLS users (or, for that matter, those who want to
use a meta key) may need to explicitly set
the tty in 8 bit mode through the appropriate
.Va stty
(1)
command in, e.g., the
.Va ~/.login
file.
.Ss "OS variant support (+)"
A number of new builtin commands are provided to support features in
particular operating systems.
All are described in detail in the
.Va Builtin commands
section.
.Pp
On systems that support TCF (aix-ibm370, aix-ps2),
.Va getspath
and
.Va setspath
get and set the system execution path,
.Va getxvers
and
.Va setxvers
get and set the experimental version prefix
and
.Va migrate
migrates processes between sites.
The
.Va jobs
builtin
prints the site on which each job is executing.
.Pp
Under BS2000,
.Va bs2cmd
executes commands of the underlying BS2000/OSD
operating system.
.Pp
Under Domain/OS,
.Va inlib
adds shared libraries to the current environment,
.Va rootnode
changes the rootnode and
.Va ver
changes the systype.
.Pp
Under Mach,
.Va setpath
is equivalent to Mach's
.Va setpath
(1).
.Pp
Under Masscomp/RTU and Harris CX/UX,
.Va universe
sets the universe.
.Pp
Under Harris CX/UX,
.Va ucb
or
.Va att
runs a command under the specified
universe.
.Pp
Under Convex/OS,
.Va warp
prints or sets the universe.
.Pp
The
.Va VENDOR
,
.Va OSTYPE
and
.Va MACHTYPE
environment variables
indicate respectively the vendor, operating system and machine type
(microprocessor class or machine model) of the
system on which the shell thinks it is running.
These are particularly useful when sharing one's home directory between several
types of machines; one can, for example,
.IP "" 4
set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
.Pp
in one's
.Va ~/.login
and put executables compiled for each machine in the
appropriate directory.
.Pp
The
.Va version
shell
variable indicates what options were chosen when the shell was compiled.
.Pp
Note also the
.Va newgrp
builtin, the
.Va afsuser
and
.Va echo_style
shell variables and the system-dependent locations of
the shell's input files (see
.Va FILES
).
.Ss "Signal handling"
Login shells ignore interrupts when reading the file
.Va ~/.logout
The shell ignores quit signals unless started with
.Fl q\fR.
Login shells catch the terminate signal, but non-login shells inherit the
terminate behavior from their parents.
Other signals have the values which the shell inherited from its parent.
.Pp
In shell scripts, the shell's handling of interrupt and terminate signals
can be controlled with
.Va onintr
, and its handling of hangups can be
controlled with
.Va hup
and
.Va nohup
.Pp
The shell exits on a hangup (see also the
.Va logout
shell variable).
By
default, the shell's children do too, but the shell does not send them a
hangup when it exits.
.Va hup
arranges for the shell to send a hangup to
a child when it exits, and
.Va nohup
sets a child to ignore hangups.
.Ss "Terminal management (+)"
The shell uses three different sets of terminal (
.Dq tty
) modes:
`edit', used when editing,
.Sq quote
, used when quoting literal characters,
and
.Sq execute
, used when executing commands.
The shell holds some settings in each mode constant, so commands which leave
the tty in a confused state do not interfere with the shell.
The shell also matches changes in the speed and padding of the tty.
The list of tty modes that are kept constant
can be examined and modified with the
.Va setty
builtin.
Note that although the editor uses CBREAK mode (or its equivalent),
it takes typed-ahead characters anyway.
.Pp
The
.Va echotc
,
.Va settc
and
.Va telltc
commands can be used to
manipulate and debug terminal capabilities from the command line.
.Pp
On systems that support SIGWINCH or SIGWINDOW, the shell
adapts to window resizing automatically and adjusts the environment
variables
.Va LINES
and
.Va COLUMNS
if set.
If the environment
variable
.Va TERMCAP
contains li# and co# fields, the shell adjusts
them to reflect the new window size.
.Sh REFERENCE
The next sections of this manual describe all of the available
.Va Builtin commands
,
.Va Special aliases
and
.Va Special shell variables
.Ss "Builtin commands"
.Bl -tag -width XXXXXXX -offset indent
.It Ar %job
A synonym for the
.Va fg
builtin command.
.It Ar %job \&&
A synonym for the
.Va bg
builtin command.
.It Ar \&:
Does nothing, successfully.
.Pp
.It Ar @
.It Ar @ name = expr
.It Ar @ name[index] = expr
.It Ar @ name++|--
.It Ar @name[index]++|--
The first form prints the values of all shell variables.
.Pp
The second form assigns the value of
.Va expr
to
.Va name
The third form assigns the value of
.Va expr
to the
.Va index
'th
component of
.Va name
; both
.Va name
and its
.Va index
'th component
must already exist.
.Pp
.Va expr
may contain the operators
.Sq *
,
.Sq +
, etc., as in C.
If
.Va expr
contains
.Sq <
,
.Sq >
,
.Sq &
or
.Sq
then at least that part of
.Va expr
must be placed within
.Sq ()
Note that the syntax of
.Va expr
has nothing to do with that described
under
.Va Expressions
.Pp
The fourth and fifth forms increment (
.Sq ++ )
or decrement 
.Sq ( -- )
.Va name
or its
.Va index
'th component.
.Pp
The space between
.Sq @
and
.Va name
is required.
The spaces between
.Va name
and
.Sq =
and between
.Sq =
and
.Va expr
are optional.
Components of
.Va expr
must be separated by spaces.
.It Ar alias[name[wordlist]]
Without arguments, prints all aliases.
With
.Va name
, prints the alias for name.
With
.Va name
and
.Va wordlist
, assigns
.Va wordlist
as the alias of
.Va name
.Va wordlist
is command and filename substituted.
.Va name
may not be
.Sq alias
or
.Sq unalias
See also the
.Va unalias
builtin command.
.It Ar alloc
Shows the amount of dynamic memory acquired, broken down into used and free
memory.
With an argument shows the number of free and used blocks in each size
category.
The categories start at size 8 and double at each step.
This
command's output may vary across system types, because systems other than the VAX
may use a different memory allocator.
.TP 8
.It Ar bg[%job...]
Puts the specified jobs (or, without arguments, the current job)
into the background, continuing each if it is stopped.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
or
.Sq \-
as described
under
.Va Jobs
.Pp
.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+)
.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 (+)
.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 (+)
.\" .It Ar macro can't take too many words, so I used \fB in the previous tags
Without options, the first form lists all bound keys and the editor command to which each is bound,
the second form lists the editor command to which
.Va key
is bound and
the third form binds the editor command
.Va command
to
.Va key
Options include:
.Pp
.Bl -tag -width XXX -compact
.It Fl l
Lists all editor commands and a short description of each.
.It Fl d
Binds all keys to the standard bindings for the default editor,
as per
.Va -e
and
.Va -v
below.
.It Fl e
Binds all keys to
.Va emacs
(1)\-style bindings.
Unsets
.Va vimode
.It Fl v
Binds all keys to
.Va vi
(1)\-style bindings.
Sets
.Va vimode
.It Fl a
Lists or changes key-bindings in the alternative key map.
This is the key map used in
.Va vimode
command mode.
.It Fl b
.Va key
is interpreted as
a control character written ^
.Va character
(e.g.,
.Sq ^A
) or
C-
.Va character
(e.g.,
.Sq C-A
),
a meta character written M-
.Va character
(e.g.,
.Sq M-A
),
a function key written F-
.Va string
(e.g.,
.Sq F-string
),
or an extended prefix key written X-
.Va character
(e.g.,
.Sq X-A
).
.It Fl k
.Va key
is interpreted as a symbolic arrow key name, which may be one of
`down',
.Sq up
,
.Sq left
or
.Sq right
.It Fl r
Removes
.Va key
's binding.
Be careful:
.Sq bindkey \-r
does
.Va not
bind
.Va key
to
.Va self-insert-command
(q.v.), it unbinds
.Va key
completely.
.It Fl c
.Va command
is interpreted as a builtin or external command instead of an
editor command.
.It Fl s
.Va command
is taken as a literal string and treated as terminal input
when
.Va key
is typed.
Bound keys in
.Va command
are themselves
reinterpreted, and this continues for ten levels of interpretation.
.It Fl \&-
Forces a break from option processing, so the next word is taken as
.Va key
even if it begins with '\&-'.
.It Fl u 
(or any invalid option)
Prints a usage message.
.El
.Pp
.Va key
may be a single character or a string.
If a command is bound to a string, the first character of the string is bound to
.Va sequence-lead-in
and the entire string is bound to the command.
.Pp
Control characters in
.Va key
can be literal (they can be typed by preceding
them with the editor command
.Va quoted-insert
, normally bound to
.Sq ^V
) or
written caret-character style, e.g.,
.Sq ^A
Delete is written
.Sq ^?
(caret-question mark).
.Va key
and
.Va command
can contain backslashed
escape sequences (in the style of System V
.Va echo
(1)) as follows:
.Pp
.Bl -tag -width XXXX -compact -offset indent
.It \ea
Bell
.It \eb
Backspace
.It \ee
Escape
.It \ef
Form feed
.It \en
Newline
.It \er
Carriage return
.It \et
Horizontal tab
.It \ev
Vertical tab
.It \e\fInnn
The ASCII character corresponding to the octal number
.Va nnn
.El
.Pp
`\e' nullifies the special meaning of the following character, if it has
any, notably
.Sq \e
and
.Sq ^
.It bs2cmd Va bs2000-command
(+)
Passes
.Va bs2000-command
to the BS2000 command interpreter for
execution. Only non-interactive commands can be executed, and it is
not possible to execute any command that would overlay the image
of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
.It break
Causes execution to resume after the
.Va end
of the nearest
enclosing
.Va foreach
or
.Va while
The remaining commands on the
current line are executed.
Multi-level breaks are thus
possible by writing them all on one line.
.It breaksw
Causes a break from a
.Va switch
, resuming after the
.Va endsw

.It builtins \fR(+)
Prints the names of all builtin commands.

.It bye \fR(+)
A synonym for the
.Va logout
builtin command.
Available only if the shell was so compiled;
see the
.Va version
shell variable.

.It case \fIlabel\fB:
A label in a
.Va switch
statement as discussed below.

.It cd \fR[
.Fl p\fR] [
.Fl l\fR] [
.Fl n\fR|
.Fl v\fR] [\I--\fR] [
.Va name
]
If a directory
.Va name
is given, changes the shell's working directory
to
.Va name
If not, changes to
.Va home
, unless the
.Va cdtohome
variable is not set, in which case a
.Va name
is required.
If
.Va name
is
.Sq \-
it is interpreted as the previous working directory
(see
.Va Other substitutions
).
(+)
If
.Va name
is not a subdirectory of the current directory
(and does not begin with
.Sq /
,
.Sq ./
or
.Sq ../
), each component of the variable
.Va cdpath
is checked to see if it has a subdirectory
.Va name
Finally, if
all else fails but
.Va name
is a shell variable whose value
begins with
.Sq /
or '.', then this is tried to see if it is a directory, and
the
.Fl p\fR option is implied.
.RS +8
.Pp
With
.Fl p\fR, prints the final directory stack, just like
.Va dirs
The
.Fl l\fR,
.Fl n\fR and
.Fl v\fR flags have the same effect on
.Va cd
as on
.Va dirs
, and they imply
.Fl p\fR.
(+)
Using
.Fl \-\fR forces a break from option processing so the next word
is taken as the directory
.Va name
even if it begins with '\-'. (+)
.Pp
See also the
.Va implicitcd
and
.Va cdtohome
shell variables.
.RE

.It chdir
A synonym for the
.Va cd
builtin command.

.It complete \fR[
.Va command
[\fIword\fB/\fIpattern\fB/
.Va list
[\fB:
.Va select
]
.Va /
[[
.Va suffix
]
.Va /
] ...]] (+)
Without arguments, lists all completions.
With
.Va command
, lists completions for
.Va command
With
.Va command
and
.Va word
etc., defines completions.
.RS +8
.Pp
.Va command
may be a full command name or a glob-pattern
(see
.Va Filename substitution
).
It can begin with
.Sq \-
to indicate that
completion should be used only when
.Va command
is ambiguous.
.Pp
.Va word
specifies which word relative to the current word
is to be completed, and may be one of the following:
.Pp
.PD 0
.RS +4
.TP 4
.It c
Current-word completion.
.Va pattern
is a glob-pattern which must match the beginning of the current word on
the command line.
.Va pattern
is ignored when completing the current word.
.TP 4
.It C
Like
.Va c
, but includes
.Va pattern
when completing the current word.
.TP 4
.It n
Next-word completion.
.Va pattern
is a glob-pattern which must match the beginning of the previous word on
the command line.
.TP 4
.It N
Like
.Va n
, but must match the beginning of the word two before the current word.
.TP 4
.It p
Position-dependent completion.
.Va pattern
is a numeric range, with the same syntax used to index shell
variables, which must include the current word.
.PD
.RE
.Pp
.Va list
, the list of possible completions, may be one of the following:
.Pp
.Bl -tag
.It a
Aliases
.It b
Bindings (editor commands)
.It c
Commands (builtin or external commands)
.It C
External commands which begin with the supplied path prefix
.It d
Directories
.It D
Directories which begin with the supplied path prefix
.It e
Environment variables
.It f
Filenames
.It F
Filenames which begin with the supplied path prefix
.It g
Groupnames
.It j
Jobs
.It l
Limits
.It n
Nothing
.It s
Shell variables
.It S
Signals
.It t
Plain (
.Dq text )
files
.It T
Plain (
.Dq text )
files which begin with the supplied path prefix
.It v
Any variables
.It u
Usernames
.It x
Like
.Va n ,
but prints
.Va select
when
.Va list-choices
is used.
.It X
Completions
$
.Va var
Words from the variable
.Va var
(...)
Words from the given list
\`...\`
Words from the output of command
.El
.Pp
.Va select
is an optional glob-pattern.
If given, words from only
.Va list
that match
.Va select
are considered
and the
.Va fignore
shell variable is ignored.
The last three types of completion may not have a
.Va select
pattern, and
.Va x
uses
.Va select
as an explanatory message when
the
.Va list-choices
editor command is used.
.Pp
.Va suffix
is a single character to be appended to a successful
completion.
If null, no character is appended.
If omitted (in which
case the fourth delimiter can also be omitted), a slash is appended to
directories and a space to other words.
.Pp
.Va command
invoked from \`...\` version has additional environment
variable set, the variable name is \%
.Va COMMAND_LINE
\% and
contains (as its name indicates) contents of the current (already
typed in) command line. One can examine and use contents of the
\%
.Va COMMAND_LINE
\% variable in her custom script to build more
sophisticated completions (see completion for svn(1) included in
this package).
.Pp
Now for some examples.
Some commands take only directories as arguments,
so there's no point completing plain files.
.IP "" 4
> complete cd 'p/1/d/'
.Pp
completes only the first word following
.Sq cd
(`p/1') with a directory.
.Va p
-type completion can also be used to narrow down command completion:
.IP "" 4
> co[^D]
.br
complete compress
.br
> complete \-co* 'p/0/(compress)/'
.br
> co[^D]
.br
> compress
.Pp
This completion completes commands (words in position 0,
.Sq p/0
)
which begin with
.Sq co
(thus matching
.Sq co*
) to
.Sq compress
(the only
word in the list).
The leading
.Sq \-
indicates that this completion is to be used with only
ambiguous commands.
.IP "" 4
> complete find 'n/\-user/u/'
.Pp
is an example of
.Va n
-type completion.
Any word following
.Sq find
and
immediately following
.Sq \-user
is completed from the list of users.
.IP "" 4
> complete cc 'c/\-I/d/'
.Pp
demonstrates
.Va c
-type completion.
Any word following
.Sq cc
and beginning
with
.Sq \-I
is completed as a directory.
`\-I' is not taken as part of the
directory because we used lowercase
.Va c
.Pp
Different
.Va list
s are useful with different commands.
.IP "" 4
> complete alias 'p/1/a/'
.br
> complete man 'p/*/c/'
.br
> complete set 'p/1/s/'
.br
> complete true 'p/1/x:Truth has no options./'
.Pp
These complete words following
.Sq alias
with aliases,
.Sq man
with commands,
and
.Sq set
with shell variables.
`true' doesn't have any options, so
.Va x
does nothing when completion
is attempted and prints
.Sq Truth has no options.
when completion choices are listed.
.Pp
Note that the
.Va man
example, and several other examples below, could
just as well have used 'c/*' or 'n/*' as 'p/*'.
.Pp
Words can be completed from a variable evaluated at completion time,
.IP "" 4
> complete ftp 'p/1/$hostnames/'
.br
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
.br
> ftp [^D]
.br
rtfm.mit.edu tesla.ee.cornell.edu
.br
> ftp [^C]
.br
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
.br
> ftp [^D]
.br
rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
.Pp
or from a command run at completion time:
.IP "" 4
> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
.br
> kill \-9 [^D]
.br
23113 23377 23380 23406 23429 23529 23530 PID
.Pp
Note that the
.Va complete
command does not itself quote its arguments,
so the braces, space and
.Sq $
in
.Sq {print $1}
must be quoted explicitly.
.Pp
One command can have multiple completions:
.IP "" 4
> complete dbx 'p/2/(core)/' 'p/*/c/'
.Pp
completes the second argument to
.Sq dbx
with the word
.Sq core
and all other
arguments with commands.
Note that the positional completion is specified
before the next-word completion.
Because completions are evaluated from left to right, if
the next-word completion were specified first it would always match
and the positional completion would never be executed.
This is a
common mistake when defining a completion.
.Pp
The
.Va select
pattern is useful when a command takes files with only
particular forms as arguments.
For example,
.IP "" 4
> complete cc 'p/*/f:*.[cao]/'
.Pp
completes
.Sq cc
arguments to files ending in only
.Sq .c
,
.Sq .a
, or
.Sq .o
.Va select
can also exclude files, using negation of a glob-pattern as
described under
.Va Filename substitution
One might use
.IP "" 4
> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
.Pp
to exclude precious source code from
.Sq rm
completion.
Of course, one
could still type excluded names manually or override the completion
mechanism using the
.Va complete-word-raw
or
.Va list-choices-raw
editor commands (q.v.).
.Pp
The
.Sq C
,
.Sq D
,
.Sq F
and
.Sq T

.Va list
s are like
.Sq c
,
.Sq d
,
.Sq f
and
.Sq t
respectively, but they use the
.Va select
argument in a different way: to
restrict completion to files beginning with a particular path prefix.
For
example, the Elm mail program uses
.Sq =
as an abbreviation for one's mail
directory.
One might use
.IP "" 4
> complete elm c@=@F:$HOME/Mail/@
.Pp
to complete
.Sq elm \-f =
as if it were
.Sq elm \-f ~/Mail/
Note that we used
.Sq @
instead of
.Sq /
to avoid confusion with the
.Va select
argument, and we used
`$HOME' instead of
.Sq ~
because home directory substitution works at only the
beginning of a word.
.Pp
.Va suffix
is used to add a nonstandard suffix
(not space or
.Sq /
for directories) to completed words.
.IP "" 4
> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
.Pp
completes arguments to
.Sq finger
from the list of users, appends an
.Sq @
,
and then completes after the
.Sq @
from the
.Sq hostnames
variable.
Note
again the order in which the completions are specified.
.Pp
Finally, here's a complex example for inspiration:
.IP "" 4
> complete find \e
.br
\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
.br
\&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
.br
\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
.br
\&'n/\-type/(b c d f l p s)/' \e
.br
\'c/\-/(name newer cpio ncpio exec ok user \e
.br
group fstype type atime ctime depth inum \e
.br
ls mtime nogroup nouser perm print prune \e
.br
size xdev)/' \e
.br
\&'p/*/d/'
.Pp
This completes words following
.Sq \-name
,
.Sq \-newer
,
.Sq \-cpio
or
.Sq ncpio
(note the pattern which matches both) to files,
words following
.Sq \-exec
or
.Sq \-ok
to commands, words following
.Sq user
and
.Sq group
to users and groups respectively
and words following
.Sq \-fstype
or
.Sq \-type
to members of the
given lists.
It also completes the switches themselves from the given list
(note the use of
.Va c
-type completion)
and completes anything not otherwise completed to a directory.
Whew.
.Pp
Remember that programmed completions are ignored if the word being completed
is a tilde substitution (beginning with
.Sq ~
) or a variable (beginning with
.Sq $
).
See also the
.Va uncomplete
builtin command.
.RE
.TP 8
.B continue
Continues execution of the nearest enclosing
.Va while
or
.Va foreach
The rest of the commands on the current line are executed.
.TP 8
.B default:
Labels the default case in a
.Va switch
statement.
It should come after all
.Va case
labels.
.Pp
.B dirs \fR[
.Fl l\fR] [
.Fl n\fR|
.Fl v\fR]
.br
.B dirs \-S\fR|
.Fl L \fR[
.Va filename
] (+)
.PD 0
.TP 8
.B dirs \-c \fR(+)
The first form prints the directory stack.
The top of the stack is at the
left and the first directory in the stack is the current directory.
With
.Fl l\fR,
.Sq ~
or
.Sq ~\fIname\fP
in the output is expanded explicitly
to
.Va home
or the pathname of the home directory for user \fIname\fP.
(+)
With
.Fl n\fR, entries are wrapped before they reach the edge of the screen.
(+)
With
.Fl v\fR, entries are printed one per line, preceded by their stack positions.
(+)
If more than one of
.Fl n\fR or
.Fl v\fR is given,
.Fl v\fR takes precedence.
.Fl p\fR is accepted but does nothing.
.PD
.RS +8
.Pp
With
.Fl S\fR, the second form saves the directory stack to
.Va filename
as a series of
.Va cd
and
.Va pushd
commands.
With
.Fl L\fR, the shell sources
.Va filename
, which is presumably
a directory stack file saved by the
.Fl S\fR option or the
.Va savedirs
mechanism.
In either case,
.Va dirsfile
is used if
.Va filename
is not given and
.Va ~/.cshdirs
is used if
.Va dirsfile
is unset.
.Pp
Note that login shells do the equivalent of
.Sq dirs \-L
on startup
and, if
.Va savedirs
is set,
.Sq dirs \-S
before exiting.
Because only
.Va ~/.tcshrc
is normally sourced before
.Va ~/.cshdirs
,
.Va dirsfile
should be set in
.Va ~/.tcshrc
rather than
.Va ~/.login
.Pp
The last form clears the directory stack.
.RE
.TP 8
.B echo \fR[
.Fl n\fR]
.Va word
...
Writes each
.Va word
to the shell's standard
output, separated by spaces and terminated with a newline.
The
.Va echo_style
shell variable may be set to emulate (or not) the flags and escape
sequences of the BSD and/or System V versions of
.Va echo
; see
.Va echo
(1).
.TP 8
.B echotc \fR[
.Fl sv\fR]
.Va arg
... (+)
Exercises the terminal capabilities (see
.Va termcap
(5)) in
.Va args
For example, 'echotc home' sends the cursor to the home position,
\&'echotc cm 3 10' sends it to column 3 and row 10, and
\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
in the status line.
.RS +8
.Pp
If
.Va arg
is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
value of that capability ("yes" or "no" indicating that the terminal does
or does not have that capability).
One might use this to make the output
from a shell script less verbose on slow terminals, or limit command
output to the number of lines on the screen:
.IP "" 4
> set history=\`echotc lines\`
.br
> @ history\-\-
.Pp
Termcap strings may contain wildcards which will not echo correctly.
One should use double quotes when setting a shell variable to a terminal
capability string, as in the following example that places the date in
the status line:
.IP "" 4
> set tosl="\`echotc ts 0\`"
.br
> set frsl="\`echotc fs\`"
.br
> echo \-n "$tosl";date; echo \-n "$frsl"
.Pp
With
.Fl s\fR, nonexistent capabilities return the empty string rather
than causing an error.
With
.Fl v\fR, messages are verbose.
.RE
.Pp
.B else
.br
.B end
.br
.B endif
.PD 0
.TP 8
.B endsw
See the description of the
.Va foreach
,
.Va if
,
.Va switch
, and
.Va while
statements below.
.PD
.TP 8
.B eval
.Va arg
...
Treats the arguments as input to the
shell and executes the resulting command(s) in the context
of the current shell.
This is usually used to execute commands
generated as the result of command or variable substitution,
because parsing occurs before these substitutions.
See
.Va tset
(1) for a sample use of
.Va eval
.TP 8
.B exec
.Va command
Executes the specified command in place of the current shell.
.TP 8
.B exit \fR[
.Va expr
]
The shell exits either with the value of the specified
.Va expr
(an expression, as described under
.Va Expressions
)
or, without
.Va expr
, with the value 0.
.TP 8
.B fg \fR[\fB%
.Va job
...]
Brings the specified jobs (or, without arguments, the current job)
into the foreground, continuing each if it is stopped.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
or
.Sq \-
as described
under
.Va Jobs
See also the
.Va run-fg-editor
editor command.
.TP 8
.B filetest \-
.Va op file
... (+)
Applies
.Va op
(which is a file inquiry operator as described under
.Va File inquiry operators
) to each
.Va file
and returns the results as a
space-separated list.
.Pp
.B foreach \fIname \fB(\fIwordlist\fB)
.br
\&...
.PD 0
.TP 8
.B end
Successively sets the variable
.Va name
to each member of
.Va wordlist
and executes the sequence of commands between this command
and the matching
.Va end
(Both
.Va foreach
and
.Va end
must appear alone on separate lines.)  The builtin command
.Va continue
may be used to continue the loop prematurely and
the builtin command
.Va break
to terminate it prematurely.
When this command is read from the terminal, the loop is read once
prompting with
.Sq foreach?
(or
.Va prompt2
) before any statements in
the loop are executed.
If you make a mistake typing in a
loop at the terminal you can rub it out.
.PD
.TP 8
.B getspath \fR(+)
Prints the system execution path.
(TCF only)
.TP 8
.B getxvers \fR(+)
Prints the experimental version prefix.
(TCF only)
.TP 8
.B glob \fIwordlist
Like
.Va echo
, but the
.Sq -n
parameter is not recognized and words are
delimited by null characters in the output.
Useful for
programs which wish to use the shell to filename expand a list of words.
.TP 8
.B goto \fIword
.Va word
is filename and command-substituted to
yield a string of the form
.Sq label
The shell rewinds its
input as much as possible, searches for a line of the
form
.Sq label:
, possibly preceded by blanks or tabs, and
continues execution after that line.
.TP 8
.B hashstat
Prints a statistics line indicating how effective the
internal hash table has been at locating commands (and avoiding
.Va exec
's).
An
.Va exec
is attempted for each component of the
.Va path
where the hash function indicates a possible hit, and
in each component which does not begin with a
.Sq /
.IP
On machines without
.Va vfork
(2), prints only the number and size of
hash buckets.
.Pp
.B history \fR[
.Fl hTr\fR] [
.Va n
]
.br
.B history \-S\fR|
.Fl L|
.Fl M \fR[
.Va filename
] (+)
.PD 0
.TP 8
.B history \-c \fR(+)
The first form prints the history event list.
If
.Va n
is given only the
.Va n
most recent events are printed or saved.
With
.Fl h\fR, the history list is printed without leading numbers.
If
.Va -T
is specified, timestamps are printed also in comment form.
(This can be used to
produce files suitable for loading with 'history \-L' or 'source \-h'.)
With
.Fl r\fR, the order of printing is most recent
first rather than oldest first.
.PD
.RS +8
.Pp
With
.Fl S\fR, the second form saves the history list to
.Va filename
If the first word of the
.Va savehist
shell variable is set to a
number, at most that many lines are saved.
If the second word of
.Va savehist
is set to
.Sq merge
, the history list is merged with the
existing history file instead of replacing it (if there is one) and
sorted by time stamp.
(+) Merging is intended for an environment like
the X Window System
with several shells in simultaneous use.
If the second word of
.Va savehist
is
.Sq merge
and the third word is set to
.Sq lock
, the history file update
will be serialized with other shell sessions that would possibly like
to merge history at exactly the same time.
.Pp
With
.Fl L\fR, the shell appends
.Va filename
, which is presumably a
history list saved by the
.Fl S\fR option or the
.Va savehist
mechanism,
to the history list.
.Fl M\fR is like
.Fl L\fR, but the contents of
.Va filename
are merged
into the history list and sorted by timestamp.
In either case,
.Va histfile
is used if
.Va filename
is not given and
.Va ~/.history
is used if
.Va histfile
is unset.
`history \-L' is exactly like 'source \-h' except that it does not require a
filename.
.Pp
Note that login shells do the equivalent of
.Sq history \-L
on startup
and, if
.Va savehist
is set,
.Sq history \-S
before exiting.
Because only
.Va ~/.tcshrc
is normally sourced before
.Va ~/.history
,
.Va histfile
should be set in
.Va ~/.tcshrc
rather than
.Va ~/.login
.Pp
If
.Va histlit
is set, the first and second forms print and save the literal
(unexpanded) form of the history list.
.Pp
The last form clears the history list.
.RE
.TP 8
.B hup \fR[
.Va command
] \fR(+)
With
.Va command
, runs
.Va command
such that it will exit on a hangup
signal and arranges for the shell to send it a hangup signal when the shell
exits.
Note that commands may set their own response to hangups, overriding
.Va hup
Without an argument, causes the non-interactive shell only to
exit on a hangup for the remainder of the script.
See also
.Va Signal handling
and the
.Va nohup
builtin command.
.TP 8
.B if (\fIexpr\fB) \fIcommand
If
.Va expr
(an expression, as described under
.Va Expressions
)
evaluates true, then
.Va command
is executed.
Variable substitution on
.Va command
happens early, at the same time it
does for the rest of the
.Va if
command.
.Va command
must be a simple command, not an alias, a pipeline, a command list
or a parenthesized command list, but it may have arguments.
Input/output redirection occurs even if
.Va expr
is
false and
.Va command
is thus
.Va not
executed; this is a bug.
.Pp
.B if (\fIexpr\fB) then
.br
\&...
.br
.B else if (\fIexpr2\fB) then
.br
\&...
.br
.B else
.br
\&...
.PD 0
.TP 8
.B endif
If the specified
.Va expr
is true then the commands to the
first
.Va else
are executed; otherwise if
.Va expr2
is true then
the commands to the second
.Va else
are executed, etc.
Any
number of
.Va else-if
pairs are possible; only one
.Va endif
is
needed.
The
.Va else
part is likewise optional.
(The words
.Va else
and
.Va endif
must appear at the beginning of input lines;
the
.Va if
must appear alone on its input line or after an
.Va else
.)
.PD
.TP 8
.B inlib
.Va shared-library
... (+)
Adds each
.Va shared-library
to the current environment.
There is no way
to remove a shared library.
(Domain/OS only)
.TP 8
.B jobs \fR[
.Fl l\fR]
Lists the active jobs.
With
.Fl l\fR, lists process
IDs in addition to the normal information.
On TCF systems, prints
the site on which each job is executing.
.Pp
.PD 0
.TP 8
.B kill \fR[
.Fl s
.Va signal
] \fB%
.Va job
|
.Va pid
...
.PD 0
.TP 8
.B kill \-l
The first and second forms sends the specified
.Va signal
(or, if none
is given, the TERM (terminate) signal) to the specified jobs or processes.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
or
.Sq \-
as described
under
.Va Jobs
Signals are either given by number or by name (as given in
.Va /usr/include/signal.h
, stripped of the prefix
.Sq SIG
).
There is no default
.Va job
; saying just
.Sq kill
does not send a signal
to the current job.
If the signal being sent is TERM (terminate)
or HUP (hangup), then the job or process is sent a
CONT (continue) signal as well.
The third form lists the signal names.
.PD
.TP 8
.B limit \fR[
.Fl h\fR] [
.Va resource
[
.Va maximum-use
]]
Limits the consumption by the current process and each
process it creates to not individually exceed
.Va maximum-use
on
the specified
.Va resource
If no
.Va maximum-use
is given, then
the current limit is printed; if no
.Va resource
is given, then
all limitations are given.
If the
.Fl h\fR flag is given, the
hard limits are used instead of the current limits.
The
hard limits impose a ceiling on the values of the current
limits.
Only the super-user may raise the hard limits, but
a user may lower or raise the current limits within the legal range.
.Pp
Controllable resources currently include (if supported by the OS):
.Bl -tag -width pseudoterminals -compact -offset indent
.It Va cputime
the maximum number of cpu-seconds to be used by each process
.It Va filesize
the largest single file which can be created
.It Va datasize
the maximum growth of the data+stack region via sbrk(2) beyond
the end of the program text
.It Va stacksize
the maximum size of the automatically-extended stack region
.It Va coredumpsize
the size of the largest core dump that will be created
.It Va memoryuse
the maximum amount of physical memory a process
may have allocated to it at a given time
.It Va vmemoryuse
the maximum amount of virtual memory a process
may have allocated to it at a given time (address space)
.It Va vmemoryuse
the maximum amount of virtual memory a process
may have allocated to it at a given time
.It Va heapsize
the maximum amount of memory a process
may allocate per
.Xr brk 2
system call
.It Va descriptors
or
.It Va openfiles
the maximum number of open files for this process
.It Va pseudoterminals
the maximum number of pseudo-terminals for this user
.It Va kqueues
the maximum number of kqueues allocated for this process
.It Va concurrency
the maximum number of threads for this process
.It Va memorylocked
the maximum size which a process may lock into memory using mlock(2)
.It Va maxproc
the maximum number of simultaneous processes for this user id
.It Va maxthread
the maximum number of simultaneous threads (lightweight processes) for this
user id
.It Va threads
the maximum number of threads for this process
.It Va sbsize
the maximum size of socket buffer usage for this user
.It Va swapsize
the maximum amount of swap space reserved or used for this user
.It Va maxlocks
the maximum number of locks for this user
.It Va posixlocks
the maximum number of POSIX advisory locks for this user
.It Va maxsignal
the maximum number of pending signals for this user
.It Va maxmessage
the maximum number of bytes in POSIX mqueues for this user
.It Va maxnice
the maximum nice priority the user is allowed to raise mapped from [19...-20]
to [0...39] for this user
.It Va maxrtprio
the maximum realtime priority for this user
.It Va maxrttime
the timeout for RT tasks in microseconds for this user.
.El
.Pp
.Va maximum-use
may be given as a (floating point or
integer) number followed by a scale factor.
For all limits
other than
.Va cputime
the default scale is
.Sq k
or
.Sq kilobytes
(1024 bytes); a scale factor of
.Sq m
or
.Sq megabytes
or
.Sq g
or
.Sq gigabytes
may also be used.
For
.Va cputime
the default scaling is
.Sq seconds ,
while
.Sq m
for minutes or
.Sq h
for hours, or a time of the
form
.Sq mm:ss
giving minutes and seconds may be used.
.Pp
If
.Va maximum-use
is
.Sq unlimited ,
then the limitation on the specified
.Va resource
is removed (this is equivalent to the
.Va unlimit
builtin command).
.Pp
For both
.Va resource
names and scale factors, unambiguous
prefixes of the names suffice.
.RE
.TP 8
.B log \fR(+)
Prints the
.Va watch
shell variable and reports on each user indicated
in
.Va watch
who is logged in, regardless of when they last logged in.
See also
.Va watchlog
.TP 8
.B login
Terminates a login shell, replacing it with an instance of
.Va /bin/login
. This is one way to log off, included for
compatibility with
.Xr sh 1 .
.TP 8
.B logout
Terminates a login shell.
Especially useful if
.Va ignoreeof
is set.
.TP 8
.B ls\-F \fR[\-
.Va switch
...] [
.Va file
...] (+)
Lists files like
.Sq ls \-F
, but much faster.
It identifies each type of
special file in the listing with a special character:
.Bl -tag -width x -offset indent -compact
.It Dv /
Directory
.It Dv *
Executable
.It Dv #
Block device
.It Dv %
Character device
.It Dv |
Named pipe (systems with named pipes only)
.It Dv =
Socket (systems with sockets only)
.It Dv @
Symbolic link (systems with symbolic links only)
.It Dv +
Hidden directory (AIX only) or context dependent (HP/UX only)
.It Dv :
Network special (HP/UX only)
.El
.Pp
If the
.Va listlinks
shell variable is set, symbolic links are identified
in more detail (on only systems that have them, of course):
.Pp
.PD 0
.TP 4
@
Symbolic link to a non-directory
.TP 4
>
Symbolic link to a directory
.TP 4
&
Symbolic link to nowhere
.PD
.Pp
.Va listlinks
also slows down \fIls\-F\fR and causes partitions holding
files pointed to by symbolic links to be mounted.
.Pp
If the
.Va listflags
shell variable is set to
.Sq x
,
.Sq a
or
.Sq A
, or any
combination thereof (e.g.,
.Sq xA
), they are used as flags to \fIls\-F\fR,
making it act like
.Sq ls \-xF
,
.Sq ls \-Fa
,
.Sq ls \-FA
or a combination
(e.g.,
.Sq ls \-FxA
).
On machines where
.Sq ls \-C
is not the default, \fIls\-F\fR acts like
.Sq ls \-CF
,
unless
.Va listflags
contains an
.Sq x
, in which case it acts like
.Sq ls \-xF
\fIls\-F\fR passes its arguments to
.Va ls
(1) if it is given any switches,
so
.Sq alias ls ls\-F
generally does the right thing.
.Pp
The \fBls\-F\fR builtin can list files using different colors depending on the
filetype or extension.
See the
.Va color
shell variable and the
.Va LS_COLORS
environment variable.
.RE
.Pp
.B migrate \fR[
.Fl
.Va site
]
.Va pid
|\fB%
.Va jobid
... (+)
.PD 0
.TP 8
.B migrate \-
.Va site
(+)
The first form migrates the process or job to the site specified or the
default site determined by the system path.
The second form is equivalent to
.Sq migrate \-
.Va site
$$
: it migrates the
current process to the specified site.
Migrating the shell
itself can cause unexpected behavior, because the shell
does not like to lose its tty.
(TCF only)
.PD
.TP 8
.B newgrp \fR[
.Fl \fR]
.Va [group]
(+)
Equivalent to
.Sq exec newgrp
; see
.Va newgrp
(1).
Available only if the shell was so compiled;
see the
.Va version
shell variable.
.TP 8
.B nice \fR[\fB+
.Va number
] [
.Va command
]
Sets the scheduling priority for the shell to
.Va number
, or, without
.Va number
, to 4.
With
.Va command ,
runs
.Va command
at the appropriate
priority.
The greater the
.Va number
, the less cpu
the process gets.
The super-user may specify negative
priority by using
.Sq nice \-number ...
Command is always
executed in a sub-shell, and the restrictions placed on
commands in simple
.Va if
statements apply.
.TP 8
.B nohup \fR[
.Va command
]
With
.Va command
, runs
.Va command
such that it will ignore hangup signals.
Note that commands may set their own response to hangups, overriding
.Va nohup
Without an argument, causes the non-interactive shell only to
ignore hangups for the remainder of the script.
See also
.Va Signal handling
and the
.Va hup
builtin command.
.TP 8
.B notify \fR[\fB%
.Va job
...]
Causes the shell to notify the user asynchronously when the status of any
of the specified jobs (or, without %
.Va job
, the current job) changes,
instead of waiting until the next prompt as is usual.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
or
.Sq \-
as described
under
.Va Jobs
See also the
.Va notify
shell variable.
.TP 8
.B onintr \fR[
.Fl \fR|
.Va label
]
Controls the action of the shell on interrupts.
Without arguments,
restores the default action of the shell on interrupts,
which is to terminate shell scripts or to return to the
terminal command input level.
With
.Sq \-
, causes all interrupts to be ignored.
With
.Va label
, causes the shell to execute a
.Sq goto
.Va label
when an interrupt is received or a child process terminates because it was
interrupted.
.IP "" 8
.Va onintr
is ignored if the shell is running detached and in system
startup files (see
.Va FILES
), where interrupts are disabled anyway.
.TP 8
.B popd \fR[
.Fl p\fR] [
.Fl l\fR] [
.Fl n\fR|
.Fl v\fR] \fR[\fB+
.Va n
]
Without arguments, pops the directory stack and returns to the new top directory.
With a number
.Sq +
.Va n
, discards the
.Va n
'th entry in the stack.
.IP "" 8
Finally, all forms of
.Va popd
print the final directory stack,
just like
.Va dirs
The
.Va pushdsilent
shell variable can be set to
prevent this and the
.Fl p\fR flag can be given to override
.Va pushdsilent
The
.Fl l\fR,
.Fl n\fR and
.Fl v\fR flags have the same effect on
.Va popd
as on
.Va dirs
(+)
.TP 8
.B printenv \fR[
.Va name
] (+)
Prints the names and values of all environment variables or,
with
.Va name
, the value of the environment variable
.Va name
.TP 8
.B pushd \fR[
.Fl p\fR] [
.Fl l\fR] [
.Fl n\fR|
.Fl v\fR] [
.Va name
|\fB+
.Va n
]
Without arguments, exchanges the top two elements of the directory stack.
If
.Va pushdtohome
is set,
.Va pushd
without arguments does
.Sq pushd ~
,
like
.Va cd
(+)
With
.Va name
, pushes the current working directory onto the directory
stack and changes to
.Va name
If
.Va name
is
.Sq \-
it is interpreted as the previous working directory
(see
.Va Filename substitution
).
(+)
If
.Va dunique
is set,
.Va pushd
removes any instances of
.Va name
from the stack before pushing it onto the stack.
(+)
With a number
.Sq +
.Va n
, rotates the
.Va n
th element of the
directory stack around to be the top element and changes to it.
If
.Va dextract
is set, however,
.Sq pushd +
.Va n
extracts the
.Va n
th
directory, pushes it onto the top of the stack and changes to it.
(+)
.IP "" 8
Finally, all forms of
.Va pushd
print the final directory stack,
just like
.Va dirs
The
.Va pushdsilent
shell variable can be set to
prevent this and the
.Fl p\fR flag can be given to override
.Va pushdsilent
The
.Fl l\fR,
.Fl n\fR and
.Fl v\fR flags have the same effect on
.Va pushd
as on
.Va dirs
(+)
.TP 8
.B rehash
Causes the internal hash table of the contents of the
directories in the
.Va path
variable to be recomputed.
This is
needed if the
.Va autorehash
shell variable is not set and new
commands are added to directories in
.Va path
while you are logged
in.
With
.Va autorehash
, a new command will be found
automatically, except in the special case where another command of
the same name which is located in a different directory already
exists in the hash table.
Also flushes the cache of home directories
built by tilde expansion.
.TP 8
.B repeat \fIcount command
The specified
.Va command
,
which is subject to the same restrictions as the
.Va command
in the one line
.Va if
statement above, is executed
.Va count
times.
I/O redirections occur exactly once, even if
.Va count
is 0.
.TP 8
.B rootnode //
.Va nodename
(+)
Changes the rootnode to //
.Va nodename
, so that
.Sq /
will be interpreted
as
.Sq //
.Va nodename
(Domain/OS only)
.Pp
.B sched \fR(+)
.br
.B sched \fR[
.Va +
]
.Va hh:mm command
\fR(+)
.PD 0
.TP 8
.B sched \-
.Va n
(+)
The first form prints the scheduled-event list.
The
.Va sched
shell variable may be set to define the format in which
the scheduled-event list is printed.
The second form adds
.Va command
to the scheduled-event list.
For example,
.PD
.RS +8
.IP "" 4
> sched 11:00 echo It\e's eleven o\e'clock.
.Pp
causes the shell to echo
.Sq It's eleven o'clock .
at 11 AM.
The time may be in 12-hour AM/PM format
.IP "" 4
.\" TODO
> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
.Pp
or may be relative to the current time:
.IP "" 4
> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
.Pp
A relative time specification may not use AM/PM format.
The third form removes item
.Va n
from the event list:
.Bd -literal -offset indent
> sched
	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
	2  Wed Apr  4 17:00  set prompt=[%h] It's after 5; go home: >
> sched \-2
> sched
	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
.Ed
.Pp
A command in the scheduled-event list is executed just before the first
prompt is printed after the time when the command is scheduled.
It is possible to miss the exact time when the command is to be run, but
an overdue command will execute at the next prompt.
A command which comes due while the shell
is waiting for user input is executed immediately.
However, normal operation of an already-running command will not
be interrupted so that a scheduled-event list element may be run.
.Pp
This mechanism is similar to, but not the same as, the
.Va at
(1)
command on some Unix systems.
Its major disadvantage is that it may not run a command at exactly the
specified time.
Its major advantage is that because
.Va sched
runs directly from
the shell, it has access to shell variables and other structures.
This provides a mechanism for changing one's working environment
based on the time of day.
.RE
.Pp
.B set
.br
.B set
.Va name
...
.br
.B set
.Va name
\fB=
.Va word
...
.br
.B set [\-r] [\-f|\-l]
.Va name
\fB=(\fIwordlist
.Va )
... (+)
.br
.B set
.Va name[index]
\fB=
.Va word
...
.br
.B set \-r \fR(+)
.br
.B set \-r
.Va name
... (+)
.PD 0
.TP 8
.B set \-r
.Va name
\fB=
.Va word
... (+)
The first form of the command prints the value of all shell variables.
Variables which contain more than a single word print as a
parenthesized word list.
The second form sets
.Va name
to the null string.
The third form sets
.Va name
to the single
.Va word
The fourth form sets
.Va name
to the list of words in
.Va wordlist
In all cases the value is command and filename expanded.
If
.Fl r\fR is specified, the value is set read-only.
If
.Fl f\fR or
.Fl l\fR are specified, set only unique words keeping their order.
.Fl f\fR prefers the first occurrence of a word, and
.Fl l\fR the last.
The fifth form sets the
.Va index
'th component of
.Va name
to
.Va word
;
this component must already exist.
The sixth form lists only the names of all shell variables that are read-only.
The seventh form makes
.Va name
read-only, whether or not it has a value.
The eighth form is the same as the third form, but
make
.Va name
read-only at the same time.
.PD
.IP "" 8
These arguments can be repeated to set and/or make read-only multiple variables
in a single set command.
Note, however, that variable expansion
happens for all arguments before any setting occurs.
Note also that
.Sq =
can
be adjacent to both
.Va name
and
.Va word
or separated from both by
whitespace, but cannot be adjacent to only one or the other.
See also the
.Va unset
builtin command.
.TP 8
.B setenv \fR[
.Va name
[
.Va value
]]
Without arguments, prints the names and values of all environment variables.
Given
.Va name
, sets the environment variable
.Va name
to
.Va value
or, without
.Va value
, to the null string.
.TP 8
.B setpath
.Va path
(+)
Equivalent to
.Va setpath
(1).
(Mach only)
.TP 8
.B setspath\fR LOCAL|
.Va site
|
.Va cpu
...
(+)
Sets the system execution path.
(TCF only)
.TP 8
.B settc
.Va cap value
(+)
Tells the shell to believe that the terminal capability
.Va cap
(as defined in
.Va termcap
(5)) has the value
.Va value
No sanity checking is done.
Concept terminal users may have to
.Sq settc xn no
to get proper
wrapping at the rightmost column.
.TP 8
.B setty \fR[
.Fl d\fR|
.Fl q\fR|
.Fl x\fR] [
.Fl a\fR] [[
.Va +
|
.Fl \fR]
.Va mode
] (+)
Controls which tty modes (see
.Va Terminal management
)
the shell does not allow to change.
.Fl d\fR,
.Fl q\fR or
.Fl x\fR tells
.Va setty
to act
on the
.Sq edit
,
.Sq quote
or
.Sq execute
set of tty modes respectively; without
.Fl d\fR,
.Fl q\fR or
.Fl x\fR,
.Sq execute
is used.
.IP "" 8
Without other arguments,
.Va setty
lists the modes in the chosen set
which are fixed on (`+mode') or off (`\-mode').
The available modes, and thus the display, vary from system to system.
With
.Fl a\fR, lists all tty modes in the chosen set
whether or not they are fixed.
With \fB+
.Va mode
,
.Fl
.Va mode
or
.Va mode
, fixes
.Va mode
on or off
or removes control from
.Va mode
in the chosen set.
For example,
.Sq setty +echok echoe
fixes
.Sq echok
mode on and allows commands
to turn
.Sq echoe
mode on or off, both when the shell is executing commands.
.TP 8
.B setxvers\fR [
.Va string
] (+)
Set the experimental version prefix to
.Va string
, or removes it
if
.Va string
is omitted.
(TCF only)
.TP 8
.B shift \fR[
.Va variable
]
Without arguments, discards
.Va argv
[1] and shifts the members of
.Va argv
to the left.
It is an error for
.Va argv
not to be set or to have
less than one word as value.
With
.Va variable
, performs the
same function on
.Va variable
.TP 8
.B source \fR[
.Fl h\fR]
.Va name
[
.Va args
...]
The shell reads and executes commands from
.Va name
The commands are not placed on the history list.
If any
.Va args
are given, they are placed in
.Va argv
(+)
.Va source
commands may be nested;
if they are nested too deeply the shell may run out of file descriptors.
An error in a
.Va source
at any level terminates all nested
.Va source
commands.
With
.Fl h\fR, commands are placed on the history list instead of being
executed, much like
.Sq history \-L
.TP 8
.B stop \fB%
.Va job
|
.Va pid
...
Stops the specified jobs or processes which are executing in the background.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
or
.Sq \-
as described
under
.Va Jobs
There is no default
.Va job
; saying just
.Sq stop
does not stop
the current job.
.TP 8
.B suspend
Causes the shell to stop in its tracks, much as if it had
been sent a stop signal with
.Va ^Z
This is most often used to
stop shells started by
.Va su
(1).
.Pp
.B switch (\fIstring\fB)
.br
.B case \fIstr1\fB:
.PD 0
.IP "" 4
\&...
.br
.B breaksw
.Pp
\&...
.Pp
.B default:
.IP "" 4
\&...
.br
.B breaksw
.TP 8
.B endsw
Each case label is successively matched, against the
specified
.Va string
which is first command and filename expanded.
The file metacharacters
.Sq *
,
.Sq \&?
and
.Sq [...]
may be used
in the case labels, which are variable expanded.
If none
of the labels match before a
.Sq default
label is found, then
the execution begins after the default label.
Each case
label and the default label must appear at the beginning of
a line.
The command
.Va breaksw
causes execution to continue
after the
.Va endsw
Otherwise control may fall through case
labels and default labels as in C.
If no label matches and
there is no default, execution continues after the
.Va endsw
.PD
.TP 8
.B telltc \fR(+)
Lists the values of all terminal capabilities (see
.Va termcap
(5)).
.TP 8
.B termname \fR[
.Va terminal type
] \fR(+)
Tests if
.Va terminal type
(or the current value of
.Va TERM
if no
.Va terminal type
is given) has an entry in the hosts termcap(5) or
terminfo(5) database. Prints the terminal type to stdout and returns 0
if an entry is present otherwise returns 1.
.TP 8
.B time \fR[
.Va command
]
Executes
.Va command
(which must be a simple command, not an alias,
a pipeline, a command list or a parenthesized command list)
and prints a time summary as described under the
.Va time
variable.
If necessary, an extra shell is created to print the time statistic when
the command completes.
Without
.Va command
, prints a time summary for the current shell and its
children.
.TP 8
.B umask \fR[
.Va value
]
Sets the file creation mask to
.Va value
, which is given in octal.
Common values for the mask are
002, giving all access to the group and read and execute access to others, and
022, giving read and execute access to the group and others.
Without
.Va value
, prints the current file creation mask.
.TP 8
.B unalias
.Va pattern
.br
Removes all aliases whose names match
.Va pattern
`unalias *' thus removes all aliases.
It is not an error for nothing to be
.Va unalias
ed.
.TP 8
.B uncomplete
.Va pattern
(+)
Removes all completions whose names match
.Va pattern
`uncomplete *' thus removes all completions.
It is not an error for nothing to be
.Va uncomplete
d.
.TP 8
.B unhash
Disables use of the internal hash table to speed location of
executed programs.
.TP 8
.B universe
.Va universe
(+)
Sets the universe to
.Va universe
(Masscomp/RTU only)
.TP 8
.B unlimit \fR[
.Fl hf\fR] [
.Va resource
]
Removes the limitation on
.Va resource
or, if no
.Va resource
is
specified, all
.Va resource
limitations.
With
.Fl h\fR, the corresponding hard limits are removed.
Only the super-user may do this.
Note that
.Va unlimit
may not exit successful, since most systems
do not allow
.Va descriptors
to be unlimited.
With
.Fl f\fR errors are ignored.
.TP 8
.B unset \fIpattern
Removes all variables whose names match
.Va pattern
, unless they are read-only.
`unset *' thus removes all variables unless they are read-only;
this is a bad idea.
It is not an error for nothing to be
.Va unset
.TP 8
.B unsetenv \fIpattern
Removes all environment variables whose names match
.Va pattern
`unsetenv *' thus removes all environment variables;
this is a bad idea.
It is not an error for nothing to be
.Va unsetenv
ed.
.TP 8
.B ver \fR[
.Va systype
[
.Va command
]] (+)
Without arguments, prints
.Va SYSTYPE
With
.Va systype
, sets
.Va SYSTYPE
to
.Va systype
With
.Va systype
and
.Va command
, executes
.Va command
under
.Va systype
.Va systype
may be
.Sq bsd4.3
or
.Sq sys5.3
(Domain/OS only)
.TP 8
.B wait
The shell waits for all background jobs.
If the shell is interactive, an
interrupt will disrupt the wait and cause the shell to print the names and job
numbers of all outstanding jobs.
.TP 8
.B warp
.Va universe
(+)
Sets the universe to
.Va universe
(Convex/OS only)
.TP 8
.B watchlog \fR(+)
An alternate name for the
.Va log
builtin command (q.v.).
Available only if the shell was so compiled;
see the
.Va version
shell variable.
.TP 8
.B where
.Va command
(+)
Reports all known instances of
.Va command
, including aliases, builtins and
executables in
.Va path
.TP 8
.B which\fR
.Va command
(+)
Displays the command that will be executed by the shell after substitutions,
.Va path
searching, etc.
The builtin command is just like
.Va which
(1), but it correctly reports
.Nm
aliases and builtins and is 10 to 100 times faster.
See also the
.Va which-command
editor command.
.Pp
.B while (\fIexpr
.Va )
.br
\&...
.PD 0
.TP 8
.B end
Executes the commands between the
.Va while
and the matching
.Va end
while
.Va expr
(an expression, as described under
.Va Expressions
)
evaluates non-zero.
.Va while
and
.Va end
must appear alone on their input lines.
.Va break
and
.Va continue
may be used to terminate or continue the
loop prematurely.
If the input is a terminal, the user is prompted the first time
through the loop as with
.Va foreach
.PD
.Ss "Special aliases (+)"
If set, each of these aliases executes automatically at the indicated time.
They are all initially undefined.
.TP 8
.B beepcmd
Runs when the shell wants to ring the terminal bell.
.TP 8
.B cwdcmd
Runs after every change of working directory.
For example, if the user is
working on an X window system using
.Va xterm
(1) and a re-parenting window
manager that supports title bars such as
.Va twm
(1) and does
.RS +8
.IP "" 4
> alias cwdcmd  'echo \-n "^[]2;${HOST}:$cwd ^G"'
.Pp
then the shell will change the title of the running
.Va xterm
(1)
to be the name of the host, a colon, and the full current working directory.
A fancier way to do that is
.IP "" 4
> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
.Pp
This will put the hostname and working directory on the title bar but
only the hostname in the icon manager menu.
.Pp
Note that putting a
.Va cd
,
.Va pushd
or
.Va popd
in
.Va cwdcmd
may cause an infinite loop.
It is the author's opinion that anyone doing
so will get what they deserve.
.RE
.TP 8
.B jobcmd
Runs before each command gets executed, or when the command changes state.
This is similar to
.Va postcmd
, but it does not print builtins.
.RS +8
.IP "" 4
> alias jobcmd  'echo \-n "^[]2\e;\e!#:q^G"'
.Pp
then executing
.Va vi foo.c
will put the command string in the xterm title bar.
.RE
.TP 8
.B helpcommand
Invoked by the
.Va run-help
editor command.
The command name for which help
is sought is passed as sole argument.
For example, if one does
.RS +8
.IP "" 4
> alias helpcommand '\e!:1 --help'
.Pp
then the help display of the command itself will be invoked, using the GNU
help calling convention.
Currently there is no easy way to account for various calling conventions (e.g.,
the customary Unix
.Sq -h
), except by using a table of many commands.
.RE
.TP 8
.B periodic
Runs every
.Va tperiod
minutes.
This provides a convenient means for
checking on common but infrequent changes such as new mail.
For example,
if one does
.RS +8
.IP "" 4
> set tperiod = 30
.br
> alias periodic checknews
.Pp
then the
.Va checknews
(1) program runs every 30 minutes.
If
.Va periodic
is set but
.Va tperiod
is unset or set to 0,
.Va periodic
behaves like
.Va precmd
.RE
.TP 8
.B precmd
Runs just before each prompt is printed.
For example, if one does
.RS +8
.IP "" 4
> alias precmd date
.Pp
then
.Va date
(1) runs just before the shell prompts for each command.
There are no limits on what
.Va precmd
can be set to do, but discretion
should be used.
.RE
.TP 8
.B postcmd
Runs before each command gets executed.
.RS +8
.IP "" 4
> alias postcmd  'echo \-n "^[]2\e;\e!#:q^G"'
.Pp
then executing
.Va vi foo.c
will put the command string in the xterm title bar.
.RE
.TP 8
.B shell
Specifies the interpreter for executable scripts which do not themselves
specify an interpreter.
The first word should be a full path name to the
desired interpreter (e.g.,
.Sq /bin/csh
or
.Sq /usr/local/bin/tcsh
).
.Ss "Special shell variables"
The variables described in this section have special meaning to the shell.
.Pp
The shell sets
.Va addsuffix ,
.Va argv ,
.Va autologout ,
.Va csubstnonl ,
.Va command ,
.Va echo_style ,
.Va edit ,
.Va gid ,
.Va group ,
.Va home ,
.Va loginsh ,
.Va oid ,
.Va path ,
.Va prompt ,
.Va prompt2 ,
.Va prompt3 ,
.Va shell ,
.Va shlvl ,
.Va tcsh ,
.Va term ,
.Va tty ,
.Va uid ,
.Va user
and
.Va version
at
startup; they do not change thereafter unless changed by the user.
The shell updates
.Va cwd ,
.Va dirstack ,
.Va owd
and
.Va status
when necessary,
and sets
.Va logout
on logout.
.Pp
The shell synchronizes
.Va group ,
.Va home ,
.Va path ,
.Va shlvl ,
.Va term and
.Va user
with the environment variables of the same names:
whenever the environment variable changes the shell changes the corresponding
shell variable to match (unless the shell variable is read-only) and vice
versa.
Note that although
.Va cwd
and
.Va PWD
have identical meanings, they
are not synchronized in this manner, and that the shell automatically
converts between the different formats of
.Va path
and
.Va PATH
.TP 8
.B addsuffix \fR(+)
If set, filename completion adds
.Sq /
to the end of directories and a space
to the end of normal files when they are matched exactly.
Set by default.
.TP 8
.B afsuser \fR(+)
If set,
.Va autologout
's autolock feature uses its value instead of
the local username for kerberos authentication.
.TP 8
.B ampm \fR(+)
If set, all times are shown in 12-hour AM/PM format.
.TP 8
.B anyerror \fR(+)
This variable selects what is propagated to the value of the
.Va status
variable. For more information see the description of the
.Va status
variable below.
.TP 8
.B argv
The arguments to the shell.
Positional parameters are taken from
.Va argv
,
i.e.,
.Sq $1
is replaced by
.Sq $argv[1]
, etc.
Set by default, but usually empty in interactive shells.
.TP 8
.B autocorrect \fR(+)
If set, the
.Va spell-word
editor command is invoked automatically before
each completion attempt.
.TP 8
.B autoexpand \fR(+)
If set, the
.Va expand-history
editor command is invoked automatically
before each completion attempt. If this is set to
.Va onlyhistory
, then
only history will be expanded and a second completion will expand filenames.
.TP 8
.B autolist \fR(+)
If set, possibilities are listed after an ambiguous completion.
If set to
.Sq ambiguous
, possibilities are listed only when no new
characters are added by completion.
.TP 8
.B autologout \fR(+)
The first word is the number of minutes of inactivity before automatic
logout.
The optional second word is the number of minutes of inactivity
before automatic locking.
When the shell automatically logs out, it prints
.Sq auto-logout
, sets the
variable
.Va logout
to
.Sq automatic
and exits.
When the shell automatically locks, the user is required to enter his password
to continue working.
Five incorrect attempts result in automatic logout.
Set to
.Sq 60
(automatic logout after 60 minutes, and no locking) by default
in login and superuser shells, but not if the shell thinks it is running
under a window system (i.e., the
.Va DISPLAY
environment variable is set),
the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
.Va version
shell variable).
See also the
.Va afsuser
and
.Va logout
shell variables.
.TP 8
.B autorehash \fR(+)
If set, the internal hash table of the contents of the directories in the
.Va path
variable will be recomputed if a command is not found in the hash
table.
In addition, the list of available commands will be rebuilt for each
command completion or spelling correction attempt if set to
.Sq complete
or
`correct' respectively; if set to
.Sq always
, this will be done for both
cases.
.TP 8
.B backslash_quote \fR(+)
.\" TODO
If set, backslashes (`\e') always quote
.Sq \e
,
.Sq \&' ,
and
.Sq \&"
This may make
complex quoting tasks easier, but it can cause syntax errors in
.Xr csh 1
scripts.
.TP 8
.B catalog
The file name of the message catalog.
If set, tcsh use
.Sq tcsh.${catalog}
as a message catalog instead of
default
.Sq tcsh
.TP 8
.B cdpath
A list of directories in which
.Va cd
should search for
subdirectories if they aren't found in the current directory.
.TP 8
.B cdtohome \fR(+)
If not set,
.Va cd
requires a directory
.Va name
, and will not go to the
.Va home
directory if it's omitted.
This is set by default.
.TP 8
.B color
If set, it enables color display for the builtin \fBls\-F\fR and it passes
.Fl \-color=auto\fR to
.Va ls
Alternatively, it can be set to only
\fBls\-F\fR or only
.Va ls
to enable color to only one command.
Setting
it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
.TP 8
.B colorcat
If set, it enables color escape sequence for NLS message files.
And display colorful NLS messages.
.TP 8
.B command \fR(+)
If set, the command which was passed to the shell with the
.Va -c
flag (q.v.).
.TP 8
.B compat_expr \fR(+)
If set, the shell will evaluate expressions right to left, like the original
.Xr csh 1
.TP 8
.B complete \fR(+)
If set to
.Sq igncase
, the completion becomes case insensitive.
If set to
.Sq enhance
, completion ignores case and considers
hyphens and underscores to be equivalent; it will also treat
periods, hyphens and underscores (`.',
.Sq \-
and
.Sq _
) as word
separators.
If set to
.Sq Enhance
, completion matches uppercase and underscore
characters explicitly and matches lowercase and hyphens in a
case-insensitive manner; it will treat periods, hyphens and underscores
as word separators.
.TP 8
.B continue \fR(+)
If set to a list of commands, the shell will continue the listed
commands, instead of starting a new one.
.TP 8
.B continue_args \fR(+)
Same as continue, but the shell will execute:
.RS +8
.IP "" 4
echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
.RE
.TP 8
.B correct \fR(+)
If set to
.Sq cmd
, commands are automatically spelling-corrected.
If set to
.Sq complete
, commands are automatically completed.
If set to
.Sq all
, the entire command line is corrected.
.TP 8
.B csubstnonl \fR(+)
If set, newlines and carriage returns in command substitution are
replaced by spaces.
Set by default.
.TP 8
.B cwd
The full pathname of the current directory.
See also the
.Va dirstack
and
.Va owd
shell variables.
.TP 8
.B dextract \fR(+)
If set,
.Sq pushd +
.Va n
extracts the
.Va n
th directory from the directory
stack rather than rotating it to the top.
.TP 8
.B dirsfile \fR(+)
The default location in which
.Sq dirs \-S
and
.Sq dirs \-L
look for
a history file.
If unset,
.Va ~/.cshdirs
is used.
Because only
.Va ~/.tcshrc
is normally sourced before
.Va ~/.cshdirs
,
.Va dirsfile
should be set in
.Va ~/.tcshrc
rather than
.Va ~/.login
.TP 8
.B dirstack \fR(+)
An array of all the directories on the directory stack.
`$dirstack[1]' is the current working directory,
.Sq $dirstack[2]
the first directory on the stack, etc.
Note that the current working directory is
.Sq $dirstack[1]
but
.Sq =0
in
directory stack substitutions, etc.
One can change the stack arbitrarily by setting
.Va dirstack
,
but the first element (the current working directory) is always correct.
See also the
.Va cwd
and
.Va owd
shell variables.
.TP 8
.B dspmbyte \fR(+)
Has an effect iff 'dspm' is listed as part of the
.Va version
shell variable.
If set to
.Sq euc
, it enables display and editing EUC-kanji(Japanese) code.
If set to
.Sq sjis
, it enables display and editing Shift-JIS(Japanese) code.
If set to
.Sq big5
, it enables display and editing Big5(Chinese) code.
If set to
.Sq utf8
, it enables display and editing Utf8(Unicode) code.
If set to the following format, it enables display and editing of original
multi-byte code format:
.RS +8
.IP "" 4
> set dspmbyte = 0000....(256 bytes)....0000
.Pp
The table requires
.Va just
256 bytes.
Each character of 256 characters
corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
Each
character
.\" (position in this table?)
is set to number 0,1,2 and 3.
Each number has the following meaning:
.br
0 ... not used for multi-byte characters.
.br
1 ... used for the first byte of a multi-byte character.
.br
2 ... used for the second byte of a multi-byte character.
.br
3 ... used for both the first byte and second byte of a multi-byte character.
.\" SHK: I tried my best to get the following to be grammatically correct.
.\" However, I still don't understand what's going on here.
In the
.\" following example, there are three bytes, but the text seems to refer to
.\" each nybble as a character.
What's going on here?  It this 3-byte code
.\" in the table?  The text above seems to imply that there are 256
.\" characters/bytes in the table.
If I get some more info on this (perhaps
.\" a complete example), I could fix the text to be grammatically correct.
.\" (steve.kelem@xilinx.com 1999/09/13)
.Pp
Example:
.br
If set to
.Sq 001322
, the first character (means 0x00 of the ASCII code) and
second character (means 0x01 of ASCII code) are set to
.Sq 0
Then, it is not
used for multi-byte characters.
The 3rd character (0x02) is set to '1',
indicating that it is used for the first byte of a multi-byte character.
The 4th character(0x03) is set '3'.
It is used for both the first byte and
the second byte of a multi-byte character.
The 5th and 6th characters
(0x04,0x05) are set to '2', indicating that they are used for the second
byte of a multi-byte character.
.Pp
The GNU fileutils version of ls cannot display multi-byte
filenames without the -N ( --literal ) option.
If you are using
this version, set the second word of dspmbyte to "ls".
If not, for
example, "ls-F -l" cannot display multi-byte filenames.
.Pp
Note:
.br
This variable can only be used if KANJI and DSPMBYTE has been defined at
compile time.
.RE
.TP 8
.B dunique \fR(+)
If set,
.Va pushd
removes any instances of
.Va name
from the stack before pushing it onto the stack.
.TP 8
.B echo
If set, each command with its arguments is echoed just before it is
executed.
For non-builtin commands all expansions occur before
echoing.
Builtin commands are echoed before command and filename
substitution, because these substitutions are then done selectively.
Set by the
.Fl x\fR command line option.
.TP 8
.B echo_style \fR(+)
The style of the
.Va echo
builtin.
May be set to
.Pp
.RS +8
.PD 0
.TP 8
bsd
Don't echo a newline if the first argument is
.Sq \-n ;
the default for
.Xr csh 1
.TP 8
sysv
Recognize backslashed escape sequences in echo strings.
.TP 8
both
Recognize both the
.Sq \-n
flag and backslashed escape sequences; the default
for
.Nm
.TP 8
none
Recognize neither.
.PD
.Pp
Set by default to the local system default.
The BSD and System V
options are described in the
.Va echo
(1) man pages on the appropriate
systems.
.RE
.TP 8
.B edit \fR(+)
If set, the command-line editor is used.
Set by default in interactive
shells.
.TP 8
.B editors \fR(+)
A list of command names for the
.Va run-fg-editor
editor command to match.
If not set, the
.Va EDITOR
(`ed' if unset) and
.Va VISUAL
(`vi' if unset)
environment variables will be used instead.
.TP 8
.B ellipsis \fR(+)
If set, the
.Sq %c
/`%.' and
.Sq %C
prompt sequences (see the
.Va prompt
shell variable) indicate skipped directories with an ellipsis (`...')
instead of
.Sq /<skipped>
.TP 8
.B euid \fR(+)
The user's effective user ID.
.TP 8
.B euser \fR(+)
The first matching passwd entry name corresponding to the effective user ID.
.TP 8
.B fignore \fR(+)
Lists file name suffixes to be ignored by completion.
.TP 8
.B filec
In
.Nm
, completion is always used and this variable is ignored
by default. If
.B edit
is unset, then the traditional
.Xr csh 1
completion is used.
If set in
.Xr csh 1
, filename completion is used.
.TP 8
.B gid \fR(+)
The user's real group ID.
.TP 8
.B globdot \fR(+)
If set, wild-card glob patterns will match files and directories beginning
with
.Sq .
except for
.Sq .
and
.Sq ..
.TP 8
.B globstar \fR(+)
If set, the
.Sq **
and
.Sq ***
file glob patterns will match any string of
characters including
.Sq /
traversing any existing sub-directories.
(e.g.
`ls **.c' will list all the .c files in the current directory tree).
If used by itself, it will match zero or more sub-directories
(e.g.
.Sq ls /usr/include/**/time.h
will list any file named
.Sq time.h
in the /usr/include directory tree; whereas
.Sq ls /usr/include/**time.h
will match any file in the /usr/include directory tree ending in
.Sq time.h
).
To prevent problems with recursion, the
.Sq **
glob-pattern will not
descend into a symbolic link containing a directory.
To override this,
use
.Sq ***
.TP 8
.B group \fR(+)
The user's group name.
.TP 8
.B highlight
If set, the incremental search match (in
.Va i-search-back
and
.Va i-search-fwd
) and the region between the mark and the cursor are
highlighted in reverse video.
.IP "" 8
Highlighting requires more frequent terminal writes, which introduces extra
overhead. If you care about terminal performance, you may want to leave this
unset.
.TP 8
.B histchars
A string value determining the characters used in \fBHistory
substitution\fR (q.v.).
The first character of its value is used as
the history substitution character, replacing the default character
`!'.
The second character of its value replaces the character
.Sq ^
in
quick substitutions.
.TP 8
.B histdup \fR(+)
Controls handling of duplicate entries in the history list.
If set to
`all' only unique history events are entered in the history list.
If
set to
.Sq prev
and the last history event is the same as the current
command, then the current command is not entered in the history.
If
set to
.Sq erase
and the same event is found in the history list, that
old event gets erased and the current one gets inserted.
Note that the
`prev' and
.Sq all
options renumber history events so there are no gaps.
.TP 8
.B histfile \fR(+)
The default location in which
.Sq history \-S
and
.Sq history \-L
look for
a history file.
If unset,
.Va ~/.history
is used.
.Va histfile
is
useful when sharing the same home directory between different machines,
or when saving separate histories on different terminals.
Because only
.Va ~/.tcshrc
is normally sourced before
.Va ~/.history
,
.Va histfile
should be set in
.Va ~/.tcshrc
rather than
.Va ~/.login
.TP 8
.B histlit \fR(+)
If set, builtin and editor commands and the
.Va savehist
mechanism
use the literal (unexpanded) form of lines in the history list.
See
also the
.Va toggle-literal-history
editor command.
.TP 8
.B history
The first word indicates the number of history events to save.
The
optional second word (+) indicates the format in which history is
printed; if not given,
.Sq %h\et%T\et%R\en
is used.
The format sequences
are described below under
.Va prompt
; note the variable meaning of
`%R'.
Set to
.Sq 100
by default.
.TP 8
.B home
Initialized to the home directory of the invoker.
The filename
expansion of
.Sq
.Va ~
refers to this variable.
.TP 8
.B ignoreeof
If set to the empty string or
.Sq 0
and the input device is a terminal,
the
.Va end-of-file
command (usually generated by the user by typing
`^D' on an empty line) causes the shell to print `Use "exit" to leave
tcsh.' instead of exiting.
This prevents the shell from accidentally
being killed.
Historically this setting exited after 26 successive
EOF's to avoid infinite loops.
If set to a number
.Va n
, the shell
ignores
.Va n - 1
consecutive
.Va end-of-file
s and exits on the
.Va n
th.
(+) If unset,
.Sq 1
is used, i.e., the shell exits on a
single
.Sq ^D
.TP 8
.B implicitcd \fR(+)
If set, the shell treats a directory name typed as a command as though
it were a request to change to that directory.
If set to
.Va verbose
,
the change of directory is echoed to the standard output.
This behavior
is inhibited in non-interactive shell scripts, or for command strings
with more than one word.
Changing directory takes precedence over
executing a like-named command, but it is done after alias
substitutions.
Tilde and variable expansions work as expected.
.TP 8
.B inputmode \fR(+)
If set to
.Sq insert
or
.Sq overwrite
, puts the editor into that input mode
at the beginning of each line.
.TP 8
.B killdup \fR(+)
Controls handling of duplicate entries in the kill ring.
If set to
`all' only unique strings are entered in the kill ring.
If set to
`prev' and the last killed string is the same as the current killed
string, then the current string is not entered in the ring.
If set
to
.Sq erase
and the same string is found in the kill ring, the old
string is erased and the current one is inserted.
.TP 8
.B killring \fR(+)
Indicates the number of killed strings to keep in memory.
Set to
.Sq 30
by default.
If unset or set to less than
.Sq 2
, the shell will only
keep the most recently killed string.
Strings are put in the killring by the editor commands that delete
(kill) strings of text, e.g.
.Va backward-delete-word
,
.Va kill-line
, etc, as well as the
.Va copy-region-as-kill
command.
The
.Va yank
editor command will yank the most recently killed string
into the command-line, while
.Va yank-pop
(see
.Va Editor commands
)
can be used to yank earlier killed strings.
.TP 8
.B listflags \fR(+)
If set to
.Sq x
,
.Sq a
or
.Sq A
, or any combination thereof (e.g.,
.Sq xA
), they
are used as flags to \fIls\-F\fR, making it act like
.Sq ls \-xF
, `ls
\-Fa',
.Sq ls \-FA
or a combination (e.g.,
.Sq ls \-FxA
):
.Sq a
shows all
files (even if they start with a
.Sq .
),
.Sq A
shows all files but
.Sq .
and
`..', and
.Sq x
sorts across instead of down.
If the second word of
.Va listflags
is set, it is used as the path to
.Sq ls(1)
.TP 8
.B listjobs \fR(+)
If set, all jobs are listed when a job is suspended.
If set to
.Sq long
,
the listing is in long format.
.TP 8
.B listlinks \fR(+)
If set, the \fIls\-F\fR builtin command shows the type of file to which
each symbolic link points.
.TP 8
.B listmax \fR(+)
The maximum number of items which the
.Va list-choices
editor command
will list without asking first.
.TP 8
.B listmaxrows \fR(+)
The maximum number of rows of items which the
.Va list-choices
editor
command will list without asking first.
.TP 8
.B loginsh \fR(+)
Set by the shell if it is a login shell.
Setting or unsetting it
within a shell has no effect.
See also
.Va shlvl
.TP 8
.B logout \fR(+)
Set by the shell to
.Sq normal
before a normal logout,
.Sq automatic
before
an automatic logout, and
.Sq hangup
if the shell was killed by a hangup
signal (see
.Va Signal handling
).
See also the
.Va autologout
shell variable.
.TP 8
.B mail
A list of files and directories to check for incoming mail, optionally
preceded by a numeric word.
Before each prompt, if 10 minutes have
passed since the last check, the shell checks each file and says `You
have new mail.' (or, if
.Va mail
contains multiple files, `You have
new mail in
.Va name
.') if the filesize is greater than zero in size
and has a modification time greater than its access time.
.Pp
.RS +8
.PD
.Pp
If you are in a login shell, then no mail file is reported unless it has
been modified after the time the shell has started up, to prevent
redundant notifications.
Most login programs will tell you whether or not
you have mail when you log in.
.Pp
If a file specified in
.Va mail
is a directory, the shell will count each
file within that directory as a separate message, and will report `You have
.Va n
mails.' or
.Sq You have
.Va n
mails in
.Va name
as appropriate.
This functionality is provided primarily for those systems which store mail
in this manner, such as the Andrew Mail System.
.Pp
If the first word of
.Va mail
is numeric it is taken as a different mail
checking interval, in seconds.
.Pp
Under very rare circumstances, the shell may report
.Sq You have mail.
instead
of
.Sq You have new mail.
.RE
.TP 8
.B matchbeep \fR(+)
If set to
.Sq never
, completion never beeps.
If set to
.Sq nomatch
, it beeps only when there is no match.
If set to
.Sq ambiguous
, it beeps when there are multiple matches.
If set to
.Sq notunique
, it beeps when there is one exact and other longer matches.
If unset,
.Sq ambiguous
is used.
.TP 8
.B nobeep \fR(+)
If set, beeping is completely disabled.
See also
.Va visiblebell
.TP 8
.B noclobber
If set, restrictions are placed on output redirection to insure that files
are not accidentally destroyed and that
.Sq >>
redirections refer to existing
files, as described in the
.Va Input/output
section.
.TP 8
.B noding
If set, disable the printing of
.Sq DING!
in the
.Va prompt
time
specifiers at the change of hour.
.TP 8
.B noglob
If set,
.Va Filename substitution
and
.Va Directory stack substitution
(q.v.) are inhibited.
This is most useful in shell scripts which do not deal
with filenames, or after a list of filenames has been obtained and further
expansions are not desirable.
.TP 8
.B nokanji \fR(+)
If set and the shell supports Kanji (see the
.Va version
shell variable),
it is disabled so that the meta key can be used.
.TP 8
.B nonomatch
If set, a
.Va Filename substitution
or
.Va Directory stack substitution
(q.v.) which does not match any
existing files is left untouched rather than causing an error.
It is still an error for the substitution to be
malformed, e.g.,
.Sq echo [
still gives an error.
.TP 8
.B nostat \fR(+)
A list of directories (or glob-patterns which match directories; see
.Va Filename substitution
) that should not be
.Va stat
(2)ed during a
completion operation.
This is usually used to exclude directories which
take too much time to
.Va stat
(2), for example
.Va /afs
.TP 8
.B notify
If set, the shell announces job completions asynchronously.
The default is to present job completions just before printing a prompt.
.TP 8
.B oid \fR(+)
The user's real organization ID.
(Domain/OS only)
.TP 8
.B owd \fR(+)
The old working directory, equivalent to the
.Sq \-
used by
.Va cd
and
.Va pushd
See also the
.Va cwd
and
.Va dirstack
shell variables.
.TP 8
.B padhour
If set, enable the printing of padding '0' for hours, in 24 and 12 hour
formats.
E.G.: 07:45:42 vs. 7:45:42.
.TP 8
.B parseoctal
To retain compatibily with older versions numeric variables starting with
0 are not interpreted as octal. Setting this variable enables proper octal
parsing.
.TP 8
.B path
A list of directories in which to look for executable commands.
A null word specifies the current directory.
If there is no
.Va path
variable then only full path names will execute.
.Va path
is set by the shell at startup from the
.Va PATH
environment
variable or, if
.Va PATH
does not exist, to a system-dependent default
something like
.Sq (/usr/local/bin /usr/bsd /bin /usr/bin .)
The shell may put
.Sq .
first or last in
.Va path
or omit it entirely
depending on how it was compiled; see the
.Va version
shell variable.
A shell which is given neither the
.Fl c\fR nor the
.Fl t\fR option
hashes the contents of the directories in
.Va path
after
reading
.Va ~/.tcshrc
and each time
.Va path
is reset.
If one adds a new command to a directory in
.Va path
while the shell
is active, one may need to do a
.Va rehash
for the shell to find it.
.TP 8
.B printexitvalue \fR(+)
If set and an interactive program exits with a non-zero status, the shell
prints
.Sq Exit
.Va status
.TP 8
.B prompt
The string which is printed before reading each command from the terminal.
.Va prompt
may include any of the following formatting sequences (+), which
are replaced by the given information:
.Pp
.RS +8
.PD 0
.TP 4
%/
The current working directory.
.TP 4
%~
The current working directory, but with one's home directory
represented by
.Sq ~
and other users' home directories represented by
`~user' as per
.Va Filename substitution
`~user' substitution
happens only if the shell has already used
.Sq ~
.Va user
in a pathname
in the current session.
.TP 4
%c[[0]
.Va n
], %.[[0]
.Va n
]
The trailing component of the current working directory, or
.Va n
trailing components if a digit
.Va n
is given.
If
.Va n
begins with
.Sq 0
, the number of skipped components precede
the trailing component(s) in the format
.Sq /<
.Va skipped
>trailing
If the
.Va ellipsis
shell variable is set, skipped components
are represented by an ellipsis so the whole becomes
.Sq ...trailing
`~' substitution is done as in
.Sq %~
above, but the
.Sq ~
component
is ignored when counting trailing components.
.TP 4
%C
Like %c, but without
.Sq ~
substitution.
.TP 4
%h, %!, !
The current history event number.
.TP 4
%M
The full hostname.
.TP 4
%m
The hostname up to the first
.Sq .
.TP 4
%S (%s)
Start (stop) standout mode.
.TP 4
%B (%b)
Start (stop) boldfacing mode.
.TP 4
%U (%u)
Start (stop) underline mode.
.TP 4
%t, %@
The time of day in 12-hour AM/PM format.
.TP 4
%T
Like
.Sq %t
, but in 24-hour format (but see the
.Va ampm
shell variable).
.TP 4
%p
The
.Sq precise
time of day in 12-hour AM/PM format, with seconds.
.TP 4
%P
Like
.Sq %p
, but in 24-hour format (but see the
.Va ampm
shell variable).
.TP 4
\e
.Va c
.Va c
is parsed as in
.Va bindkey
.TP 4
^
.Va c
.Va c
is parsed as in
.Va bindkey
.TP 4
%%
A single
.Sq %
.TP 4
%n
The user name.
.TP 4
%N
The effective user name.
.TP 4
%j
The number of jobs.
.TP 4
%d
The weekday in
.Sq Day
format.
.TP 4
%D
The day in
.Sq dd
format.
.TP 4
%w
The month in
.Sq Mon
format.
.TP 4
%W
The month in
.Sq mm
format.
.TP 4
%y
The year in
.Sq yy
format.
.TP 4
%Y
The year in
.Sq yyyy
format.
.TP 4
%l
The shell's tty.
.TP 4
%L
Clears from the end of the prompt to end of the display or the end of the line.
.TP 4
%$
Expands the shell or environment variable name immediately after the
.Sq $
.TP 4
%#
`>' (or the first character of the
.Va promptchars
shell variable)
for normal users,
.Sq #
(or the second character of
.Va promptchars
)
for the superuser.
.TP 4
%{
.Va string
%}
Includes
.Va string
as a literal escape sequence.
It should be used only to change terminal attributes and
should not move the cursor location.
This
cannot be the last sequence in
.Va prompt
.TP 4
%?
The return code of the command executed just before the prompt.
.TP 4
%R
In
.Va prompt2
, the status of the parser.
In
.Va prompt3
, the corrected string.
In
.Va history
, the history string.
.PD
.Pp
`%B',
.Sq %S
,
.Sq %U
and
.Sq %{
.Va string
%}
are available in only
eight-bit-clean shells; see the
.Va version
shell variable.
.Pp
The bold, standout and underline sequences are often used to distinguish a
superuser shell.
For example,
.IP "" 4
> set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
.br
tut [37]
.Va [2:54pm]
[/usr/accts/sys] you rang? _
.Pp
If
.Sq %t
,
.Sq %@
,
.Sq %T
,
.Sq %p
, or
.Sq %P
is used, and
.Va noding
is not set,
then print
.Sq DING!
on the change of hour (i.e,
.Sq \&:00
minutes) instead of
the actual time.
.Pp
Set by default to
.Sq %#
in interactive shells.
.RE
.TP 8
.B prompt2 \fR(+)
The string with which to prompt in
.Va while
and
.Va foreach
loops and
after lines ending in
.Sq \e
The same format sequences may be used as in
.Va prompt
(q.v.);
note the variable meaning of
.Sq %R
Set by default to
.Sq %R?
in interactive shells.
.TP 8
.B prompt3 \fR(+)
The string with which to prompt when confirming automatic spelling correction.
The same format sequences may be used as in
.Va prompt
(q.v.);
note the variable meaning of
.Sq %R
Set by default to
.Sq CORRECT>%R (y|n|e|a)?
in interactive shells.
.TP 8
.B promptchars \fR(+)
If set (to a two-character string), the
.Sq %#
formatting sequence in the
.Va prompt
shell variable is replaced with the first character for
normal users and the second character for the superuser.
.TP 8
.B pushdtohome \fR(+)
If set,
.Va pushd
without arguments does
.Sq pushd ~
, like
.Va cd
.TP 8
.B pushdsilent \fR(+)
If set,
.Va pushd
and
.Va popd
do not print the directory stack.
.TP 8
.B recexact \fR(+)
If set, completion completes on an exact match even if a longer match is
possible.
.TP 8
.B recognize_only_executables \fR(+)
If set, command listing displays only files in the path that are
executable.
Slow.
.TP 8
.B rmstar \fR(+)
If set, the user is prompted before
.Sq rm *
is executed.
.TP 8
.B rprompt \fR(+)
The string to print on the right-hand side of the screen (after
the command input) when the prompt is being displayed on the left.
It recognizes the same formatting characters as
.Va prompt
It will automatically disappear and reappear as necessary, to ensure that
command input isn't obscured, and will appear only if the prompt,
command input, and itself will fit together on the first line.
If
.Va edit
isn't set, then
.Va rprompt
will be printed after
the prompt and before the command input.
.TP 8
.B savedirs \fR(+)
If set, the shell does
.Sq dirs \-S
before exiting.
If the first word is set to a number, at most that many directory stack
entries are saved.
.TP 8
.B savehist
If set, the shell does
.Sq history \-S
before exiting.
If the first word is set to a number, at most that many lines are saved.
(The number should be less than or equal to the number
.Va history
entries;
if it is set to greater than the number of
.Va history
settings, only
.Va history
entries will be saved)
If the second word is set to
.Sq merge
, the history list is merged with
the existing history file instead of replacing it (if there is one) and
sorted by time stamp and the most recent events are retained.
If the second word of
.Va savehist
is
.Sq merge
and the third word is set to
`lock', the history file update will be serialized with other shell sessions
that would possibly like to merge history at exactly the same time. (+)
.TP 8
.B sched \fR(+)
The format in which the
.Va sched
builtin command prints scheduled events;
if not given,
.Sq %h\et%T\et%R\en
is used.
The format sequences are described above under
.Va prompt
;
note the variable meaning of
.Sq %R
.TP 8
.B shell
The file in which the shell resides.
This is used in forking
shells to interpret files which have execute bits set, but
which are not executable by the system.
(See the description
of
.Va Builtin and non-builtin command execution
.)  Initialized to the
(system-dependent) home of the shell.
.TP 8
.B shlvl \fR(+)
The number of nested shells.
Reset to 1 in login shells.
See also
.Va loginsh
.TP 8
.B status
The exit status from the last command or backquote expansion, or any
command in a pipeline is propagated to
.Va status
(This is also the
default
.Xr csh 1
behavior.)
This default does not match what POSIX mandates (to return the
status of the last command only). To match the POSIX behavior, you need
to unset
.Va anyerror
.RS +8
.Pp
If the
.Va anyerror
variable is unset, the exit status of a pipeline
is determined only from the last command in the pipeline, and the exit
status of a backquote expansion is
.Va not
propagated to
.Va status
.Pp
If a command terminated abnormally, then 0200 is added to the status.
Builtin commands which fail return exit status
.Sq 1
, all other builtin
commands return status
.Sq 0
.RE
.TP 8
.B symlinks \fR(+)
Can be set to several different values to control symbolic link (`symlink')
resolution:
.RS +8
.Pp
If set to
.Sq chase
, whenever the current directory changes to a directory
containing a symbolic link, it is expanded to the real name of the directory
to which the link points.
This does not work for the user's home directory;
this is a bug.
.Pp
If set to
.Sq ignore
, the shell tries to construct a current directory
relative to the current directory before the link was crossed.
This means that
.Va cd
ing through a symbolic link and then
.Sq cd ..
ing
returns one to the original directory.
This affects only builtin commands
and filename completion.
.Pp
If set to
.Sq expand
, the shell tries to fix symbolic links by actually expanding
arguments which look like path names.
This affects any command, not just
builtins.
Unfortunately, this does not work for hard-to-recognize filenames,
such as those embedded in command options.
Expansion may be prevented by
quoting.
While this setting is usually the most convenient, it is sometimes
misleading and sometimes confusing when it fails to recognize an argument
which should be expanded.
A compromise is to use
.Sq ignore
and use the
editor command
.Va normalize-path
(bound by default to ^X-n) when necessary.
.Pp
Some examples are in order.
First, let's set up some play directories:
.IP "" 4
> cd /tmp
.br
> mkdir from from/src to
.br
> ln \-s from/src to/dst
.Pp
Here's the behavior with
.Va symlinks
unset,
.IP "" 4
> cd /tmp/to/dst; echo $cwd
.br
/tmp/to/dst
.br
> cd ..; echo $cwd
.br
/tmp/from
.Pp
here's the behavior with
.Va symlinks
set to
.Sq chase
,
.IP "" 4
> cd /tmp/to/dst; echo $cwd
.br
/tmp/from/src
.br
> cd ..; echo $cwd
.br
/tmp/from
.Pp
here's the behavior with
.Va symlinks
set to
.Sq ignore
,
.IP "" 4
> cd /tmp/to/dst; echo $cwd
.br
/tmp/to/dst
.br
> cd ..; echo $cwd
.br
/tmp/to
.Pp
and here's the behavior with
.Va symlinks
set to
.Sq expand
.IP "" 4
> cd /tmp/to/dst; echo $cwd
.br
/tmp/to/dst
.br
> cd ..; echo $cwd
.br
/tmp/to
.br
> cd /tmp/to/dst; echo $cwd
.br
/tmp/to/dst
.br
> cd ".."; echo $cwd
.br
/tmp/from
.br
> /bin/echo ..
.br
/tmp/to
.br
> /bin/echo ".."
.br
\&..
.Pp
Note that
.Sq expand
expansion 1) works just like
.Sq ignore
for builtins
like
.Va cd
, 2) is prevented by quoting, and 3) happens before
filenames are passed to non-builtin commands.
.RE
.TP 8
.B tcsh \fR(+)
The version number of the shell in the format
.Sq R.VV.Pp
,
where
.Sq R
is the major release number,
.Sq VV
the current version
and
.Sq PP
the patchlevel.
.TP 8
.B term
The terminal type.
Usually set in
.Va ~/.login
as described under
.Va Startup and shutdown
.TP 8
.B time
If set to a number, then the
.Va time
builtin (q.v.) executes automatically
after each command which takes more than that many CPU seconds.
If there is a second word, it is used as a format string for the output
of the
.Va time
builtin.
(u) The following sequences may be used in the
format string:
.Pp
.RS +8
.PD 0
.TP 4
%U
The time the process spent in user mode in cpu seconds.
.TP 4
%S
The time the process spent in kernel mode in cpu seconds.
.TP 4
%E
The elapsed (wall clock) time in seconds.
.TP 4
%P
The CPU percentage computed as (%U + %S) / %E.
.TP 4
%W
Number of times the process was swapped.
.TP 4
%X
The average amount in (shared) text space used in Kbytes.
.TP 4
%D
The average amount in (unshared) data/stack space used in Kbytes.
.TP 4
%K
The total space used (%X + %D) in Kbytes.
.TP 4
%M
The maximum memory the process had in use at any time in Kbytes.
.TP 4
%F
The number of major page faults (page needed to be brought from disk).
.TP 4
%R
The number of minor page faults.
.TP 4
%I
The number of input operations.
.TP 4
%O
The number of output operations.
.TP 4
%r
The number of socket messages received.
.TP 4
%s
The number of socket messages sent.
.TP 4
%k
The number of signals received.
.TP 4
%w
The number of voluntary context switches (waits).
.TP 4
%c
The number of involuntary context switches.
.PD
.Pp
Only the first four sequences are supported on systems without BSD resource
limit functions.
The default time format is
.Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww
for
systems that support resource usage reporting and
.Sq %Uu %Ss %E %P
for
systems that do not.
.Pp
Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
available, but the following additional sequences are:
.Pp
.PD 0
.TP 4
%Y
The number of system calls performed.
.TP 4
%Z
The number of pages which are zero-filled on demand.
.TP 4
%i
The number of times a process's resident set size was increased by the kernel.
.TP 4
%d
The number of times a process's resident set size was decreased by the kernel.
.TP 4
%l
The number of read system calls performed.
.TP 4
%m
The number of write system calls performed.
.TP 4
%p
The number of reads from raw disk devices.
.TP 4
%q
The number of writes to raw disk devices.
.PD
.Pp
and the default time format is
.Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww
Note that the CPU percentage can be higher than 100% on multi-processors.
.RE
.TP 8
.B tperiod \fR(+)
The period, in minutes, between executions of the
.Va periodic
special alias.
.TP 8
.B tty \fR(+)
The name of the tty, or empty if not attached to one.
.TP 8
.B uid \fR(+)
The user's real user ID.
.TP 8
.B user
The user's login name.
.TP 8
.B verbose
If set, causes the words of each
command to be printed, after history substitution (if any).
Set by the
.Fl v\fR command line option.
.TP 8
.B version \fR(+)
The version ID stamp.
It contains the shell's version number (see
.Va tcsh
),
origin, release date, vendor, operating system and machine (see
.Va VENDOR
,
.Va OSTYPE
and
.Va MACHTYPE
) and a comma-separated
list of options which were set at compile time.
Options which are set by default in the distribution are noted.
.Pp
.RS +8
.PD 0
.TP 6
8b
The shell is eight bit clean; default
.TP 6
7b
The shell is not eight bit clean
.TP 6
wide
The shell is multibyte encoding clean (like UTF-8)
.TP 6
nls
The system's NLS is used; default for systems with NLS
.TP 6
lf
Login shells execute
.Va /etc/csh.login
before instead of after
.Va /etc/csh.cshrc
and
.Va ~/.login
before instead of after
.Va ~/.tcshrc
and
.Va ~/.history
.TP 6
dl
`.' is put last in
.Va path
for security; default
.TP 6
nd
`.' is omitted from
.Va path
for security
.TP 6
vi
.Va vi
(1)\-style editing is the default rather than
.Va emacs
(1)\-style
.TP 6
dtr
Login shells drop DTR when exiting
.TP 6
bye
.Va bye
is a synonym for
.Va logout
and
.Va log
is an alternate name for
.Va watchlog
.TP 6
al
.Va autologout
is enabled; default
.TP 6
kan
Kanji is used if appropriate according to locale settings,
unless the
.Va nokanji
shell variable is set
.TP 6
sm
The system's
.Va malloc
(3) is used
.TP 6
hb
The
.Sq #!<program> <args>
convention is emulated when executing shell scripts
.TP 6
ng
The
.Va newgrp
builtin is available
.TP 6
rh
The shell attempts to set the
.Va REMOTEHOST
environment variable
.TP 6
afs
The shell verifies your password with the kerberos server if local
authentication fails.
The
.Va afsuser
shell variable or the
.Va AFSUSER
environment variable override your local username if set.
.PD
.Pp
An administrator may enter additional strings to indicate differences
in the local version.
.RE
.TP 8
.B vimode \fR(+)
.RS +8
If unset, various key bindings change behavior to be more
.Va emacs
(1)\-style:
word boundaries are determined by
.Va wordchars
versus other characters.
.Pp
If set, various key bindings change behavior to be more
.Va vi
(1)\-style:
word boundaries are determined by
.Va wordchars
versus whitespace
versus other characters;
cursor behavior depends upon current vi mode (command, delete, insert, replace).
.Pp
This variable is unset by
.Va bindkey

.Va -e
and
set by
.Va bindkey

.Va -v
.B vimode
may be explicitly set or unset by the user after those
.Va bindkey
operations if required.
.RE
.TP 8
.B visiblebell \fR(+)
If set, a screen flash is used rather than the audible bell.
See also
.Va nobeep
.TP 8
.B watch \fR(+)
A list of user/terminal pairs to watch for logins and logouts.
If either the user is
.Sq any
all terminals are watched for the given user
and vice versa.
Setting
.Va watch
to
.Sq (any any)
watches all users and terminals.
For example,
.RS +8
.IP "" 4
set watch = (george ttyd1 any console $user any)
.Pp
reports activity of the user
.Sq george
on ttyd1, any user on the console, and
oneself (or a trespasser) on any terminal.
.Pp
Logins and logouts are checked every 10 minutes by default, but the first
word of
.Va watch
can be set to a number to check every so many minutes.
For example,
.IP "" 4
set watch = (1 any any)
.Pp
reports any login/logout once every minute.
For the impatient, the
.Va log
builtin command triggers a
.Va watch
report at any time.
All current logins
are reported (as with the
.Va log
builtin) when
.Va watch
is first set.
.Pp
The
.Va who
shell variable controls the format of
.Va watch
reports.
.RE
.TP 8
.B who \fR(+)
The format string for
.Va watch
messages.
The following sequences
are replaced by the given information:
.Pp
.RS +8
.PD 0
.TP 4
%n
The name of the user who logged in/out.
.TP 4
%a
The observed action, i.e.,
.Sq logged on
,
.Sq logged off
or
.Sq replaced
.Va olduser
on
.TP 4
%l
The terminal (tty) on which the user logged in/out.
.TP 4
%M
The full hostname of the remote host, or
.Sq local
if the login/logout was
from the local host.
.TP 4
%m
The hostname of the remote host up to the first
.Sq .
The full name is printed if it is an IP address or an X Window System display.
.PD
.Pp
%M and %m are available on only systems that store the remote hostname in
.Va /etc/utmp
If unset,
.Sq %n has %a %l from %m.
is used, or
.Sq %n has %a %l.
on systems
which don't store the remote hostname.
.RE
.TP 8
.B wordchars \fR(+)
A list of non-alphanumeric characters to be considered part of a word by the
.Va forward-word
,
.Va backward-word
etc., editor commands.
If unset, the default value is determined based on the state of
.Va vimode
:
if
.Va vimode
is unset,
.Sq *?_\-.[]~=
is used as the default;
if
.Va vimode
is set,
.Sq _
is used as the default.
.Sh ENVIRONMENT
.TP 8
.B AFSUSER \fR(+)
Equivalent to the
.Va afsuser
shell variable.
.TP 8
.B COLUMNS
The number of columns in the terminal.
See
.Va Terminal management
.TP 8
.B DISPLAY
Used by X Window System (see
.Va X
(1)).
If set, the shell does not set
.Va autologout
(q.v.).
.TP 8
.B EDITOR
The pathname to a default editor.
Used by the
.Va run-fg-editor
editor command if the
the
.Va editors
shell variable is unset.
See also the
.Va VISUAL
environment variable.
.TP 8
.B GROUP \fR(+)
Equivalent to the
.Va group
shell variable.
.TP 8
.B HOME
Equivalent to the
.Va home
shell variable.
.TP 8
.B HOST \fR(+)
Initialized to the name of the machine on which the shell
is running, as determined by the
.Va gethostname
(2) system call.
.TP 8
.B HOSTTYPE \fR(+)
Initialized to the type of machine on which the shell
is running, as determined at compile time.
This variable is obsolete and
will be removed in a future version.
.TP 8
.B HPATH \fR(+)
A colon-separated list of directories in which the
.Va run-help
editor
command looks for command documentation.
.TP 8
.B LANG
Gives the preferred character environment.
See
.Va Native Language System support
.TP 8
.B LC_CTYPE
If set, only ctype character handling is changed.
See
.Va Native Language System support
.TP 8
.B LINES
The number of lines in the terminal.
See
.Va Terminal management
.TP 8
.B LS_COLORS
The format of this variable is reminiscent of the
.Va termcap(5)
file format; a colon-separated list of expressions of the form
"
.Va xx=string
", where "
.Va xx
" is a two-character variable name.
The
variables with their associated defaults are:
.Pp
.RS +8
.RS +4
.PD 0
.TP 12
no	0
Normal (non-filename) text
.TP 12
fi	0
Regular file
.TP 12
di	01;34
Directory
.TP 12
ln	01;36
Symbolic link
.TP 12
pi	33
Named pipe (FIFO)
.TP 12
so	01;35
Socket
.TP 12
do	01;35
Door
.TP 12
bd	01;33
Block device
.TP 12
cd	01;32
Character device
.TP 12
ex	01;32
Executable file
.TP 12
mi	(none)
Missing file (defaults to fi)
.TP 12
or	(none)
Orphaned symbolic link (defaults to ln)
.TP 12
lc	^[[
Left code
.TP 12
rc	m
Right code
.TP 12
ec	(none)
End code (replaces lc+no+rc)
.PD
.RE
.Pp
You need to include only the variables you want to change from
the default.
.Pp
File names can also be colorized based on filename extension.
This is specified in the
.Va LS_COLORS
variable using the syntax
.Va "*ext=string"
For example, using ISO 6429 codes, to color
all C\-language source files blue you would specify
.Va "*.c=34"
This would color all files ending in
.Va .c
in blue (34) color.
.Pp
Control characters can be written either in C\-style\-escaped
notation, or in stty\-like ^\-notation.
The C\-style notation
adds
.Va ^[
for Escape, \fB\_\fR for a normal space character,
and
.Va ?
for Delete.
In addition, the
.Va ^[
escape character
can be used to override the default interpretation of
.Va ^[
,
.Va ^
,
.Va :
and
.Va =
.Pp
Each file will be written as
.Va <lc>

.Va <color-code>
.Va <rc>

.Va <filename>

.Va <ec>
If the
.Va <ec>
code is undefined, the sequence
.Va <lc>
\fB<no>
.Va <rc>
will be used instead.
This is generally more convenient
to use, but less general.
The left, right and end codes are
provided so you don't have to type common parts over and over
again and to support weird terminals; you will generally not
need to change them at all unless your terminal does not use
ISO 6429 color sequences but a different system.
.Pp
If your terminal does use ISO 6429 color codes, you can
compose the type codes (i.e., all except the
.Va lc
,
.Va rc
,
and
.Va ec
codes) from numerical commands separated by semicolons.
The
most common commands are:
.Pp
.RS +8
.PD 0
.TP 4
0
to restore default color
.TP 4
1
for brighter colors
.TP 4
4
for underlined text
.TP 4
5
for flashing text
.TP 4
30
for black foreground
.TP 4
31
for red foreground
.TP 4
32
for green foreground
.TP 4
33
for yellow (or brown) foreground
.TP 4
34
for blue foreground
.TP 4
35
for purple foreground
.TP 4
36
for cyan foreground
.TP 4
37
for white (or gray) foreground
.TP 4
40
for black background
.TP 4
41
for red background
.TP 4
42
for green background
.TP 4
43
for yellow (or brown) background
.TP 4
44
for blue background
.TP 4
45
for purple background
.TP 4
46
for cyan background
.TP 4
47
for white (or gray) background
.PD
.RE
.Pp
Not all commands will work on all systems or display devices.
.Pp
A few terminal programs do not recognize the default end code
properly.
If all text gets colorized after you do a directory
listing, try changing the
.Va no
and
.Va fi
codes from 0 to the
numerical codes for your standard fore- and background colors.
.RE
.TP 8
.B MACHTYPE \fR(+)
The machine type (microprocessor class or machine model), as determined at compile time.
.TP 8
.B NOREBIND \fR(+)
If set, printable characters are not rebound to
.Va self-insert-command
See
.Va Native Language System support
.TP 8
.B OSTYPE \fR(+)
The operating system, as determined at compile time.
.TP 8
.B PATH
A colon-separated list of directories in which to look for executables.
Equivalent to the
.Va path
shell variable, but in a different format.
.TP 8
.B PWD \fR(+)
Equivalent to the
.Va cwd
shell variable, but not synchronized to it;
updated only after an actual directory change.
.TP 8
.B REMOTEHOST \fR(+)
The host from which the user has logged in remotely, if this is the case and
the shell is able to determine it.
Set only if the shell was so compiled;
see the
.Va version
shell variable.
.TP 8
.B SHLVL \fR(+)
Equivalent to the
.Va shlvl
shell variable.
.TP 8
.B SYSTYPE \fR(+)
The current system type.
(Domain/OS only)
.TP 8
.B TERM
Equivalent to the
.Va term
shell variable.
.TP 8
.B TERMCAP
The terminal capability string.
See
.Va Terminal management
.TP 8
.B USER
Equivalent to the
.Va user
shell variable.
.TP 8
.B VENDOR \fR(+)
The vendor, as determined at compile time.
.TP 8
.B VISUAL
The pathname to a default full-screen editor.
Used by the
.Va run-fg-editor
editor command if the
the
.Va editors
shell variable is unset.
See also the
.Va EDITOR
environment variable.
.Sh FILES
.PD 0
.TP 16
.I /etc/csh.cshrc
Read first by every shell.
ConvexOS, Stellix and Intel use
.Va /etc/cshrc
and
NeXTs use
.Va /etc/cshrc.std
A/UX, AMIX, Cray and IRIX have no equivalent in
.Xr csh 1
,
but read this file in
.Nm
anyway.
Solaris 2.x does not have it either, but
.Nm
reads
.Va /etc/.cshrc
(+)
.TP 16
.I /etc/csh.login
Read by login shells after
.Va /etc/csh.cshrc
ConvexOS, Stellix and Intel use
.Va /etc/login
,
NeXTs use
.Va /etc/login.std
, Solaris 2.x uses
.Va /etc/.login
and
A/UX, AMIX, Cray and IRIX use
.Va /etc/cshrc
.TP 16
.I ~/.tcshrc \fR(+)
Read by every shell after
.Va /etc/csh.cshrc
or its equivalent.
.TP 16
.I ~/.cshrc
Read by every shell, if
.Va ~/.tcshrc
doesn't exist,
after
.Va /etc/csh.cshrc
or its equivalent.
This manual uses
.Sq
.Va ~/.tcshrc
to mean `
.Va ~/.tcshrc
or,
if
.Va ~/.tcshrc
is not found,
.Va ~/.cshrc
'.
.TP 16
.I ~/.history
Read by login shells after
.Va ~/.tcshrc
if
.Va savehist
is set, but see also
.Va histfile
.TP 16
.I ~/.login
Read by login shells after
.Va ~/.tcshrc
or
.Va ~/.history
The shell may be compiled to read
.Va ~/.login
before instead of after
.Va ~/.tcshrc
and
.Va ~/.history
; see the
.Va version
shell variable.
.TP 16
.I ~/.cshdirs \fR(+)
Read by login shells after
.Va ~/.login
if
.Va savedirs
is set, but see also
.Va dirsfile
.TP 16
.I /etc/csh.logout
Read by login shells at logout.
ConvexOS, Stellix and Intel use
.Va /etc/logout
and
NeXTs use
.Va /etc/logout.std
A/UX, AMIX, Cray and IRIX have no equivalent in
.Xr csh 1
,
but read this file in
.Nm
anyway.
Solaris 2.x does not have it either, but
.Nm
reads
.Va /etc/.logout
(+)
.TP 16
.I ~/.logout
Read by login shells at logout after
.Va /etc/csh.logout
or its equivalent.
.TP 16
.I /bin/sh
Used to interpret shell scripts not starting with a
.Sq #
.TP 16
.I /tmp/sh*
Temporary file for
.Sq <<
.TP 16
.I /etc/passwd
Source of home directories for
.Sq ~name
substitutions.
.PD
.Pp
The order in which startup files are read may differ if the shell was so
compiled; see
.Va Startup and shutdown
and the
.Va version
shell variable.
.Sh "NEW FEATURES (+)"
This manual describes
.Nm
as a single entity,
but experienced
.Xr csh 1
users will want to pay special attention to
.Nm
's new features.
.Pp
A command-line editor, which supports
.Va emacs
(1)\-style
or
.Va vi
(1)\-style key bindings.
See
.Va The command-line editor
and
.Va Editor commands
.Pp
Programmable, interactive word completion and listing.
See
.Sx Completion and listing
and the
.Va complete
and
.Va uncomplete
builtin commands.
.Pp
.Va Spelling correction
(q.v.) of filenames, commands and variables.
.Pp
.Va Editor commands
(q.v.) which perform other useful functions in the middle of
typed commands, including documentation lookup
.Va ( run-help ),
quick editor restarting
.Va ( run-fg-editor )
and
command resolution
.Va ( which-command ).
.Pp
An enhanced history mechanism.
Events in the history list are time-stamped.
See also the
.Va history
command and its associated shell variables,
the previously undocumented
.Sq #
event specifier and new modifiers
under
.Va History substitution
,
the
.Va *-history
,
.Va history-search-*
,
.Va i-search-*
,
.Va vi-search-*
and
.Va toggle-literal-history
editor commands
and the
.Va histlit
shell variable.
.Pp
Enhanced directory parsing and directory stack handling.
See the
.Va cd
,
.Va pushd
,
.Va popd
and
.Va dirs
commands and their associated
shell variables, the description of
.Va Directory stack substitution
,
the
.Va dirstack
,
.Va owd
and
.Va symlinks
shell variables and
the
.Va normalize-command
and
.Va normalize-path
editor commands.
.Pp
Negation in glob-patterns.
See
.Va Filename substitution
.Pp
New
.Va File inquiry operators
(q.v.) and a
.Va filetest
builtin which uses them.
.Pp
A variety of
.Va Automatic, periodic and timed events
(q.v.) including
scheduled events, special aliases, automatic logout and terminal locking,
command timing and watching for logins and logouts.
.Pp
Support for the Native Language System
(see
.Va Native Language System support
),
OS variant features
(see
.Va OS variant support
and the
.Va echo_style
shell variable)
and system-dependent file locations (see
.Va FILES
).
.Pp
Extensive terminal-management capabilities.
See
.Va Terminal management
.Pp
New builtin commands including
.Va builtins
,
.Va hup
, \fIls\-F\fR,
.Va newgrp
,
.Va printenv
,
.Va which
and
.Va where
(q.v.).
.Pp
New variables that make useful information easily available to the shell.
See the
.Va gid
,
.Va loginsh
,
.Va oid
,
.Va shlvl
,
.Va tcsh
,
.Va tty
,
.Va uid
and
.Va version
shell variables and the
.Va HOST
,
.Va REMOTEHOST
,
.Va VENDOR
,
.Va OSTYPE
and
.Va MACHTYPE
environment
variables.
.Pp
A new syntax for including useful information in the prompt string
(see
.Va prompt
),
and special prompts for loops and spelling correction
(see
.Va prompt2
and
.Va prompt3
).
.Pp
Read-only variables.
See
.Va Variable substitution
.Sh BUGS
When a suspended command is restarted, the shell prints the directory
it started in if this is different from the current directory.
This can
be misleading (i.e., wrong) as the job may have changed directories internally.
.Pp
Shell builtin functions are not stoppable/restartable.
Command sequences
of the form
.Sq a ; b ; c
are also not handled gracefully when stopping is
attempted.
If you suspend
.Sq b
, the shell will then immediately execute
`c'.
This is especially noticeable if this expansion results from an
.Va alias
It suffices to place the sequence of commands in ()'s to force it
to a subshell, i.e.,
.Sq ( a ; b ; c )
.Pp
Control over tty output after processes are started is primitive; perhaps
this will inspire someone to work on a good virtual terminal interface.
In a virtual terminal interface much more interesting things could be
done with output control.
.Pp
Alias substitution is most often used to clumsily simulate shell procedures;
shell procedures should be provided rather than aliases.
.Pp
Control structures should be parsed rather than being recognized as
built-in commands.
This would allow control commands to be placed anywhere,
to be combined with
.Sq |
, and to be used with
.Sq &
and
.Sq ;
metasyntax.
.Pp
.Va foreach
doesn't ignore here documents when looking for its
.Va end
.Pp
It should be possible to use the
.Sq \&:
modifiers on the output of command
substitutions.
.Pp
The screen update for lines longer than the screen width is very poor
if the terminal cannot move the cursor up (i.e., terminal type
.Sq dumb
).
.Pp
.Va HPATH
and
.Va NOREBIND
don't need to be environment variables.
.Pp
Glob-patterns which do not use
.Sq \&?
,
.Sq *
or
.Sq []
or which use
.Sq {}
or
.Sq ~
are not negated correctly.
.Pp
The single-command form of
.Va if
does output redirection even if
the expression is false and the command is not executed.
.Pp
\fIls\-F\fR includes file identification characters when sorting filenames
and does not handle control characters in filenames well.
It cannot be
interrupted.
.Pp
Command substitution supports multiple commands and conditions, but not
cycles or backward
.Va goto
s.
.Pp
Report bugs at https://bugs.astron.com/, preferably with fixes.
If you want to
help maintain and test tcsh, add yourself to the mailing list in
https://mailman.astron.com/.
.Sq subscribe tcsh
on a line by itself in the body.
.Sh THE T IN TCSH
In 1964, DEC produced the PDP-6.
The PDP-10 was a later re-implementation.
It
was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
second model, the KI10.
.Pp
TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
think tank) in
1972 as an experiment in demand-paged virtual memory operating systems.
They
built a new pager for the DEC PDP-10 and created the OS to go with it.
It was
extremely successful in academia.
.Pp
In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
have only a version of TENEX, which they had licensed from BBN, for the new
box.
They called their version TOPS-20 (their capitalization is trademarked).
A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
found themselves supporting two incompatible systems on the same hardware--but
then there were 6 on the PDP-11!
.Pp
TENEX, and TOPS-20 to version 3, had command completion
via a user-code-level subroutine library called ULTCMD.
With version 3, DEC
moved all that capability and more into the monitor (`kernel' for you Unix
types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
supervisor call mechanism [are my IBM roots also showing?]).
.Pp
The creator of tcsh was impressed by this feature and several others of TENEX
and TOPS-20, and created a version of csh which mimicked them.
.Sh LIMITATIONS
The system limits argument lists to ARG_MAX characters.
.Pp
The number of arguments to a command which involves filename expansion is
limited to 1/6th the number of characters allowed in an argument list.
.Pp
Command substitutions may substitute no more characters than are allowed in
an argument list.
.Pp
To detect looping, the shell restricts the number of
.Va alias
substitutions on a single line to 20.
.Sh "SEE ALSO"
csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
termio(7), Introduction to the C Shell
.Sh VERSION
This manual documents tcsh 6.21.00 (Astron) 2019-05-08.
.Sh AUTHORS
.PD 0
.TP 2
William Joy
Original author of
.Xr csh 1
.TP 2
J.E. Kulp, IIASA, Laxenburg, Austria
Job control and directory stack features
.TP 2
Ken Greer, HP Labs, 1981
File name completion
.TP 2
Mike Ellis, Fairchild, 1983
Command name recognition/completion
.TP 2
Paul Placeway, Ohio State CIS Dept., 1983-1993
Command line editor, prompt routines, new glob syntax and numerous fixes
and speedups
.TP 2
Karl Kleinpaste, CCI 1983-4
Special aliases, directory stack extraction stuff, login/logout watch,
scheduled events, and the idea of the new prompt format
.TP 2
Rayan Zachariassen, University of Toronto, 1984
\fIls\-F\fR and
.Va which
builtins and numerous bug fixes, modifications
and speedups
.TP 2
Chris Kingsley, Caltech
Fast storage allocator routines
.TP 2
Chris Grevstad, TRW, 1987
Incorporated 4.3BSD
.Xr csh 1
into
.Nm
.TP 2
Christos S. Zoulas, Cornell U. EE Dept., 1987-94
Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
and a new version of sh.glob.c
.TP 2
James J Dempsey, BBN, and Paul Placeway, OSU, 1988
A/UX port
.TP 2
Daniel Long, NNSC, 1988
.Va wordchars
.TP 2
Patrick Wolfe, Kuck and Associates, Inc., 1988
.Va vi
mode cleanup
.TP 2
David C Lawrence, Rensselaer Polytechnic Institute, 1989
.Va autolist
and ambiguous completion listing
.TP 2
Alec Wolman, DEC, 1989
Newlines in the prompt
.TP 2
Matt Landau, BBN, 1989
.Va ~/.tcshrc
.TP 2
Ray Moody, Purdue Physics, 1989
Magic space bar history expansion
.TP 2
Mordechai ????, Intel, 1989
printprompt() fixes and additions
.TP 2
Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
Automatic spelling correction and
.Va prompt3
.TP 2
Per Hedeland, Ellemtel, Sweden, 1990-
Various bugfixes, improvements and manual updates
.TP 2
Hans J. Albertsson (Sun Sweden)
.Va ampm
,
.Va settc
and
.Va telltc
.TP 2
Michael Bloom
Interrupt handling fixes
.TP 2
Michael Fine, Digital Equipment Corp
Extended key support
.TP 2
Eric Schnoebelen, Convex, 1990
Convex support, lots of
.Xr csh 1
bug fixes,
save and restore of directory stack
.TP 2
Ron Flax, Apple, 1990
A/UX 2.0 (re)port
.TP 2
Dan Oscarsson, LTH Sweden, 1990
NLS support and simulated NLS support for non NLS sites, fixes
.TP 2
Johan Widen, SICS Sweden, 1990
.Va shlvl
, Mach support,
.Va correct-line
, 8-bit printing
.TP 2
Matt Day, Sanyo Icon, 1990
POSIX termio support, SysV limit fixes
.TP 2
Jaap Vermeulen, Sequent, 1990-91
Vi mode fixes, expand-line, window change fixes, Symmetry port
.TP 2
Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
.Va autolist
beeping options, modified the history search to search for
the whole string from the beginning of the line to the cursor.
.TP 2
Scott Krotz, Motorola, 1991
Minix port
.TP 2
David Dawes, Sydney U. Australia, Physics Dept., 1991
SVR4 job control fixes
.TP 2
Jose Sousa, Interactive Systems Corp., 1991
Extended
.Va vi
fixes and
.Va vi
delete command
.TP 2
Marc Horowitz, MIT, 1991
ANSIfication fixes, new exec hashing code, imake fixes,
.Va where
.TP 2
Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995
ETA and Pyramid port, Makefile and lint fixes,
.Va ignoreeof
=n addition, and
various other portability changes and bug fixes
.TP 2
Jeff Fink, 1992
.Va complete-word-fwd
and
.Va complete-word-back
.TP 2
Harry C. Pulley, 1992
Coherent port
.TP 2
Andy Phillips, Mullard Space Science Lab U.K., 1992
VMS-POSIX port
.TP 2
Beto Appleton, IBM Corp., 1992
Walking process group fixes,
.Xr csh 1
bug fixes,
POSIX file tests, POSIX SIGHUP
.TP 2
Scott Bolte, Cray Computer Corp., 1992
CSOS port
.TP 2
Kaveh R. Ghazi, Rutgers University, 1992
Tek, m88k, Titan and Masscomp ports and fixes.
Added autoconf support.
.TP 2
Mark Linderman, Cornell University, 1992
OS/2 port
.TP 2
Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
Linux port
.TP 2
Tim P. Starrin, NASA Langley Research Center Operations, 1993
Read-only variables
.TP 2
Dave Schweisguth, Yale University, 1993-4
New man page and tcsh.man2html
.TP 2
Larry Schwimmer, Stanford University, 1993
AFS and HESIOD patches
.TP 2
Luke Mewburn, RMIT University, 1994-6
Enhanced directory printing in prompt,
added
.Va ellipsis
and
.Va rprompt
.TP 2
Edward Hutchins, Silicon Graphics Inc., 1996
Added implicit cd.
.TP 2
Martin Kraemer, 1997
Ported to Siemens Nixdorf EBCDIC machine
.TP 2
Amol Deshpande, Microsoft, 1997
Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
and message catalog code to interface to Windows.
.TP 2
Taga Nayuta, 1998
Color ls additions.
.PD
.Pp
.Sh "THANKS TO"
Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
the other people at Ohio State for suggestions and encouragement
.Pp
All the people on the net, for putting up with,
reporting bugs in, and suggesting new additions to each and every version
.Pp
Richard M. Alderson III, for writing the
.Sq T in tcsh
section