summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/set.1
blob: e2fc43d31e92744e721d10312abe8d3ff4b3a170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
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
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
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
'\" te
.\" Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SET 1 "Nov 20, 2007"
.SH NAME
set, unset, setenv, unsetenv, export \- shell built-in functions to determine
the characteristics for environmental variables of the current shell and its
descendents
.SH SYNOPSIS
.SS "sh"
.LP
.nf
\fBset\fR [\fB--aefhkntuvx\fR [\fIargument\fR]]...
.fi

.LP
.nf
\fBunset\fR [\fIname\fR]...
.fi

.LP
.nf
\fBexport\fR [\fIname\fR]...
.fi

.SS "csh"
.LP
.nf
\fBset\fR [\fIvar\fR [= \fIvalue\fR]]
.fi

.LP
.nf
\fBset\fR \fIvar\fR [\fIn\fR] = \fIword\fR
.fi

.LP
.nf
\fBunset\fR \fIpattern\fR
.fi

.LP
.nf
\fBsetenv\fR [\fIVAR\fR [\fIword\fR]]
.fi

.LP
.nf
\fBunsetenv\fR \fIvariable\fR
.fi

.SS "ksh"
.LP
.nf
\fBset\fR [\(+-abCefhkmnopstuvx] [\(+-o \fIoption\fR]... [\(+-A \fIname\fR]
     [\fIarg\fR]...
.fi

.LP
.nf
\fBunset\fR [\fB-f\fR] \fIname\fR...
.fi

.LP
.nf
\fB**export\fR [\fIname\fR [=\fIvalue\fR]]...
.fi

.LP
.nf
\fB**export\fR [\fB-p\fR]
.fi

.SS "ksh93"
.LP
.nf
\fB+set\fR [\(+-abCefGhkmnoprstuvx] [\(+-o \fIoption\fR]... [\(+-A \fIvname\fR]
     [\fIarg\fR]...
.fi

.LP
.nf
\fB+unset\fR [\fB-fnv\fR] \fIvname\fR...
.fi

.LP
.nf
\fB++export\fR [\fB-p\fR] [\fIname\fR[=\fIvalue\fR]]...
.fi

.SH DESCRIPTION
.SS "sh"
.LP
The \fBset\fR built-in command has the following options:
.sp
.ne 2
.na
\fB\fB--\fR\fR
.ad
.RS 6n
Does not change any of the flags. This option is useful in setting \fB$1\fR to
\fB\(mi\fR\&.
.RE

.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
Marks variables which are modified or created for export.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.RS 6n
Exits immediately if a command exits with a non-zero exit status.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
Disables file name generation.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.RS 6n
Locates and remembers function commands as functions are defined. Function
commands are normally located when the function is executed.
.RE

.sp
.ne 2
.na
\fB\fB-k\fR\fR
.ad
.RS 6n
All keyword arguments are placed in the environment for a command, not just
those that precede the command name.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
Reads commands but does not execute them.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
Exits after reading and executing one command.
.RE

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.RS 6n
Treats unset variables as an error when substituting.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
Prints shell input lines as they are read.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
Prints commands and their arguments as they are executed.
.RE

.sp
.LP
Using \fB+\fR rather than \fB\(mi\fR causes these flags to be turned off. These
flags can also be used upon invocation of the shell. The current set of flags
can be found in \fB$\(mi\fR. The remaining \fIargument\fRs are positional
parameters and are assigned, in order, to \fB$1\fR, \fB$2\fR,
\fB\&.\|.\|.\|.\fR If no \fIargument\fRs are specified the values of all names
are printed.
.sp
.LP
For each \fIname\fR, \fBunset\fR removes the corresponding variable or function
value. The variables \fBPATH\fR, \fBPS1\fR, \fBPS2\fR, \fBMAILCHECK\fR, and
\fBIF\fR cannot be unset.
.sp
.LP
With the \fBexport\fR built-in, the specified \fIname\fRs are marked for
automatic export to the \fIenvironment\fR of subsequently executed commands. If
no arguments are specified, variable names that have been marked for export
during the current shell's execution are listed. Function names are \fBnot\fR
exported.
.SS "csh"
.LP
With no arguments, \fBset\fR displays the values of all shell variables.
Multiword values are displayed as a parenthesized list. With the \fIvar\fR
argument alone, \fBset\fR assigns an empty (null) value to the variable
\fIvar\fR. With arguments of the form \fIvar\fR \fB=\fR \fIvalue\fR \fBset\fR
assigns \fIvalue\fR to \fIvar\fR, where \fIvalue\fR is one of:
.sp
.ne 2
.na
\fB\fIword\fR\fR
.ad
.RS 14n
A single word (or quoted string).
.RE

.sp
.ne 2
.na
\fB\fB(\fR\fIwordlist\fR\fB)\fR\fR
.ad
.RS 14n
A space-separated list of words enclosed in parentheses.
.RE

.sp
.LP
Values are command and filename expanded before being assigned. The form
\fBset\fR \fIvar\fR\fB[\fR\fIn\fR\fB]=\fR\fIword\fR replaces the \fIn\fR'th
word in a multiword value with \fIword\fR.
.sp
.LP
\fBunset\fR removes variables whose names match (filename substitution)
\fIpattern\fR. All variables are removed by `\fBunset *\fR'.
.sp
.LP
With no arguments, \fBsetenv\fR displays all environment variables. With the
\fIVAR\fR argument, \fBsetenv\fR sets the environment variable
\fB\fR\fIVAR\fR\fB \fR to an empty (null) value. (By convention, environment
variables are normally specified upper-case names.) With both \fIVAR\fR and
\fIword\fR arguments specified, \fBsetenv\fR sets \fIVAR\fR to \fIword\fR,
which must be either a single word or a quoted string. The \fBPATH\fR variable
can take multiple \fIword\fR arguments, separated by colons (see EXAMPLES). The
most commonly used environment variables, \fBUSER\fR, \fBTERM\fR, and
\fBPATH\fR, are automatically imported to and exported from the \fBcsh\fR
variables \fBuser\fR, \fBterm\fR, and \fBpath\fR. Use \fBsetenv\fR if you need
to change these variables. In addition, the shell sets the \fBPWD\fR
environment variable from the \fBcsh\fR variable \fBcwd\fR whenever the latter
changes.
.sp
.LP
The environment variables \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR,
\fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR take immediate effect
when changed within the C shell. See \fBenviron\fR(7) for descriptions of these
environment variables.
.sp
.LP
\fBunsetenv\fR removes \fIvariable\fR from the environment. As with
\fBunset\fR, pattern matching is not performed.
.SS "ksh"
.LP
The flags for the \fBset\fR built-in have meaning as follows:
.sp
.ne 2
.na
\fB\fB-A\fR\fR
.ad
.RS 13n
Array assignment. Unsets the variable \fIname\fR and assigns values
sequentially from the list \fIarg\fR. If \fB+A\fR is used, the variable
\fIname\fR is not unset first.
.RE

.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 13n
All subsequent variables that are defined are automatically exported.
.RE

.sp
.ne 2
.na
\fB\fB-b\fR\fR
.ad
.RS 13n
Causes the shell to notify the user asynchronously of background job
completions.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 13n
Prevents existing files from being overwritten by the shell's \fB>\fR
redirection operator. The \fB>|\fR redirection operator overrides this
noclobber option for an individual file.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.RS 13n
If a command has a non-zero exit status, executes the \fBERR\fR trap, if set,
and exits. This mode is disabled while reading profiles.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 13n
Disables file name generation.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.RS 13n
Each command becomes a tracked alias when first encountered.
.RE

.sp
.ne 2
.na
\fB\fB-k\fR\fR
.ad
.RS 13n
All variable assignment arguments are placed in the environment for a command,
not just those that precede the command name.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 13n
Background jobs run in a separate process group and a line prints upon
completion. The exit status of background jobs is reported in a completion
message. On systems with job control, this flag is turned on automatically for
interactive shells.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 13n
Reads commands and checks them for syntax errors, but does not execute them.
Ignored for interactive shells.
.RE

.sp
.ne 2
.na
\fB\fB+o\fR\fR
.ad
.RS 13n
Writes the current option settings to standard output in a format that is
suitable for reinput to the shell as commands that achieve the same option
settings.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR \fIoption\fR\fR
.ad
.RS 13n
The \fIoption\fR argument can be one of the following option names:
.sp
.ne 2
.na
\fB\fBallexport\fR\fR
.ad
.RS 14n
Same as \fB-a\fR.
.RE

.sp
.ne 2
.na
\fB\fBerrexit\fR\fR
.ad
.RS 14n
Same as \fB-e\fR.
.RE

.sp
.ne 2
.na
\fB\fBbgnice\fR\fR
.ad
.RS 14n
All background jobs are run at a lower priority. This is the default mode.
\fBemacs\fR Puts you in an \fBemacs\fR style in-line editor for command entry.
.RE

.sp
.ne 2
.na
\fB\fBgmacs\fR\fR
.ad
.RS 14n
Puts you in a \fBgmacs\fR style in-line editor for command entry.
.RE

.sp
.ne 2
.na
\fB\fBignoreeof\fR\fR
.ad
.RS 14n
The shell does not exit on end-of-file. The command \fBexit\fR must be used.
.RE

.sp
.ne 2
.na
\fB\fBkeyword\fR\fR
.ad
.RS 14n
Same as \fB-k\fR.
.RE

.sp
.ne 2
.na
\fB\fBmarkdirs\fR\fR
.ad
.RS 14n
All directory names resulting from file name generation have a trailing \fB/\fR
appended.
.RE

.sp
.ne 2
.na
\fB\fBmonitor\fR\fR
.ad
.RS 14n
Same as \fB-m\fR.
.RE

.sp
.ne 2
.na
\fB\fBnoclobber\fR\fR
.ad
.RS 14n
Prevents redirection operator \fB>\fR from truncating existing files. Requires
the \fB>|\fR operator to truncate a file when turned on. Same as \fB-C\fR.
.RE

.sp
.ne 2
.na
\fB\fBnoexec\fR\fR
.ad
.RS 14n
Same as \fB-n\fR.
.RE

.sp
.ne 2
.na
\fB\fBnoglob\fR\fR
.ad
.RS 14n
Same as \fB-f\fR.
.RE

.sp
.ne 2
.na
\fB\fBnolog\fR\fR
.ad
.RS 14n
Does not save function definitions in history file.
.RE

.sp
.ne 2
.na
\fB\fBnotify\fR\fR
.ad
.RS 14n
Same as \fB-b\fR.
.RE

.sp
.ne 2
.na
\fB\fBnounset\fR\fR
.ad
.RS 14n
Same as \fB-u\fR.
.RE

.sp
.ne 2
.na
\fB\fBprivileged\fR\fR
.ad
.RS 14n
Same as \fB-p\fR.
.RE

.sp
.ne 2
.na
\fB\fBverbose\fR\fR
.ad
.RS 14n
Same as \fB-v\fR.
.RE

.sp
.ne 2
.na
\fB\fBtrackall\fR\fR
.ad
.RS 14n
Same as \fB-h\fR.
.RE

.sp
.ne 2
.na
\fB\fBvi\fR\fR
.ad
.RS 14n
Puts you in insert mode of a \fBvi\fR style in-line editor until you hit escape
character \fB033\fR. This puts you in control mode. A return sends the line.
.RE

.sp
.ne 2
.na
\fB\fBviraw\fR\fR
.ad
.RS 14n
Each character is processed as it is typed in \fBvi\fR mode.
.RE

.sp
.ne 2
.na
\fB\fBxtrace\fR\fR
.ad
.RS 14n
Same as \fB-x\fR.
.RE

.RE

.sp
.LP
If no option name is supplied then the current option settings are printed.
.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 8n
Disables processing of the \fB$HOME/.profile\fR file and uses the file
\fB/etc/suid_profile\fR instead of the \fBENV\fR file. This mode is on whenever
the effective uid is not equal to the real uid, or when the effective gid is
not equal to the real gid. Turning this off causes the effective uid and gid to
be set to the real uid and gid.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 8n
Sorts the positional parameters lexicographically.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 8n
Exits after reading and executing one command.
.RE

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.RS 8n
Treats unset parameters as an error when substituting.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 8n
Prints shell input lines as they are read.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 8n
Prints commands and their arguments as they are executed.
.RE

.sp
.ne 2
.na
\fB\fB\(mi\fR\fR
.ad
.RS 8n
Turns off \fB-x\fR and \fB-v\fR flags and stops examining arguments for flags.
.RE

.sp
.ne 2
.na
\fB\fB-\fR\fR
.ad
.RS 8n
Does not change any of the flags. This option is useful in setting \fB$1\fR to
a value beginning with \fB\(mi\fR\&. If no arguments follow this flag then the
positional parameters are unset.
.RE

.sp
.LP
Using \fB+\fR rather than \fB\(mi\fR causes these flags to be turned off. These
flags can also be used upon invocation of the shell. The current set of flags
can be found in \fB$\(mi\fR. Unless \fB-A\fR is specified, the remaining
arguments are positional parameters and are assigned, in order, to \fB$1\fR
\fB$2\fR .\|.\|.. If no arguments are specified then the names and values of
all variables are printed on the standard output.
.sp
.LP
The variables specified by the list of \fIname\fRs are unassigned, that is,
their values and attributes are erased. \fBreadonly\fR variables cannot be
unset. If the \fB-f\fR flag is set, then the names refer to \fBfunction\fR
names. Unsetting \fBERRNO\fR, \fBLINENO\fR, \fBMAILCHECK\fR, \fBOPTARG\fR,
\fBOPTIND\fR, \fBRANDOM\fR, \fBSECONDS\fR, \fBTMOUT\fR, and \fB_\fR removes
their special meaning even if they are subsequently assigned.
.sp
.LP
When using \fBunset\fR, the variables specified by the list of \fIname\fRs are
unassigned, i.e., their values and attributes are erased. \fBreadonly\fR
variables cannot be unset. If the \fB-f\fR, flag is set, then the names refer
to \fBfunction\fR names. Unsetting \fBERRNO\fR, \fBLINENO\fR, \fBMAILCHECK\fR,
\fBOPTARG\fR, \fBOPTIND\fR, \fBRANDOM\fR, \fBSECONDS\fR, \fBTMOUT\fR, and
\fB_\fR removes their special meaning even if they are subsequently assigned.
.sp
.LP
With the \fBexport\fR built-in, the specified \fIname\fRs are marked for
automatic export to the \fBenvironment\fR of subsequently-executed commands.
.sp
.LP
When \fB-p\fR is specified, \fBexport\fR writes to the standard output the
names and values of all exported variables in the following format:
.sp
.in +2
.nf
"export %s=%s\en", \fIname\fR, \fIvalue\fR
.fi
.in -2
.sp

.sp
.LP
if \fIname\fR is set, and:
.sp
.in +2
.nf
"export %s\en", \fIname\fR
.fi
.in -2
.sp

.sp
.LP
if \fIname\fR is unset.
.sp
.LP
The shell formats the output, including the proper use of quoting, so that it
is suitable for reinput to the shell as commands that achieve the same
exporting results, except for the following:
.RS +4
.TP
1.
Read-only variables with values cannot be reset.
.RE
.RS +4
.TP
2.
Variables that were unset at the time they were output are not reset to the
unset state if a value is assigned to the variable between the time the state
was saved and the time at which the saved output is reinput to the shell.
.RE
.sp
.LP
On this manual page, \fBksh\fR(1) commands that are preceded by one or two
\fB*\fR (asterisks) are treated specially in the following ways:
.RS +4
.TP
1.
Variable assignment lists preceding the command remain in effect when the
command completes.
.RE
.RS +4
.TP
2.
I/O redirections are processed after variable assignments.
.RE
.RS +4
.TP
3.
Errors cause a script that contains them to abort.
.RE
.RS +4
.TP
4.
Words, following a command preceded by \fB**\fR that are in the format of a
variable assignment, are expanded with the same rules as a variable assignment.
This means that tilde substitution is performed after the \fB=\fR sign and word
splitting and file name generation are not performed.
.RE
.SS "ksh93"
.LP
\fBset\fR sets or unsets options and positional parameters. Options that are
specified with a \fB-\fR cause the options to be set. Options that are
specified with a \fB+\fR cause the option to be unset.
.sp
.LP
\fBset\fR without any options or arguments displays the names and values of all
shell variables in the order of the collation sequence in the current locale.
The values are quoted so that they are suitable for input again to the shell.
.sp
.LP
If no arguments are specified, not even the end of options argument \fB--\fR,
the positional parameters are unchanged. Otherwise, unless the \fB-A\fR option
has been specified, the positional parameters are replaced by the list of
arguments. A first argument of \fB--\fR is ignored when setting positional
parameters.
.sp
.LP
For backwards compatibility, a \fBset\fR command without any options specified,
whose first argument is \fB-\fR turns off the \fB-v\fR and \fB-x\fR options. If
any additional arguments are specified, they replace the positional parameters.
.sp
.LP
The options for set in \fBksh93\fR are:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 15n
Set the export attribute for each variable whose name does not contain a . that
you assign a value in the current shell environment.
.RE

.sp
.ne 2
.na
\fB\fB-A\fR \fIname\fR\fR
.ad
.RS 15n
Assign the arguments sequentially to the array named by \fIname\fR starting at
subscript \fB0\fR rather than to the positional parameters.
.RE

.sp
.ne 2
.na
\fB\fB-b\fR\fR
.ad
.RS 15n
The shell writes a message to standard error as soon it detects that a
background job completes rather than waiting until the next prompt.
.RE

.sp
.ne 2
.na
\fB\fB-B\fR\fR
.ad
.RS 15n
Enable \fB{...}\fR group expansion. On by default.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 15n
Prevents existing regular files from being overwritten using the > redirection
operator. The \fB>|\fR redirection overrides this \fBnoclobber\fR option.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.RS 15n
A simple command that has a \fBnon-zero\fR exit status causes the shell to exit
unless the simple command is:
.RS +4
.TP
.ie t \(bu
.el o
contained in an \fB&&\fR or \fB||\fR list
.RE
.RS +4
.TP
.ie t \(bu
.el o
the command immediately following \fBif\fR, \fBwhile\fR, or \fBuntil\fR
.RE
.RS +4
.TP
.ie t \(bu
.el o
contained in the pipeline following \fB!\fR
.RE
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 15n
Pathname expansion is disabled.
.RE

.sp
.ne 2
.na
\fB\fB-G\fR\fR
.ad
.RS 15n
Causes \fB**\fR by itself to also match all sub-directories during pathname
expansion.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.RS 15n
Obsolete. Causes each command whose name has the syntax of an alias to become a
tracked alias when it is first encountered.
.RE

.sp
.ne 2
.na
\fB\fB-H\fR\fR
.ad
.RS 15n
Enable \fB!\fR-style history expansion similar to csh.
.RE

.sp
.ne 2
.na
\fB\fB-k\fR\fR
.ad
.RS 15n
This is obsolete. All arguments of the form \fIname\fR\fB=\fR\fIvalue\fR are
removed and placed in the variable assignment list for the command. Ordinarily,
variable assignments must precede command arguments.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 15n
When enabled, the shell runs background jobs in a separate process group and
displays a line upon completion. This mode is enabled by default for
interactive shells on systems that support job control.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 15n
The shell reads commands and checks for syntax errors, but does not execute the
command. Usually specified on command invocation.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR [\fIoption\fR]\fR
.ad
.RS 15n
If option is not specified, the list of options and their current settings is
written to standard output. When invoked with a \fB+\fR the options are written
in a format that can be input again to the shell to restore the settings. This
option can be repeated to enable or disable multiple options.
.sp
The value of \fIoption\fR must be one of the following:
.sp
.ne 2
.na
\fB\fBallexport\fR\fR
.ad
.RS 15n
Same as \fB-a\fR.
.RE

.sp
.ne 2
.na
\fB\fBbgnice\fR\fR
.ad
.RS 15n
All background jobs are run at lower priorities.
.RE

.sp
.ne 2
.na
\fB\fBbraceexpand\fR\fR
.ad
.RS 15n
Same as \fB-B\fR.
.RE

.sp
.ne 2
.na
\fB\fBemacs\fR\fR
.ad
.RS 15n
Enables or disables \fBemacs\fR editing mode.
.RE

.sp
.ne 2
.na
\fB\fBerrexit\fR\fR
.ad
.RS 15n
Same as \fB-e\fR.
.RE

.sp
.ne 2
.na
\fB\fBglobstar\fR\fR
.ad
.RS 15n
Equivalent to \fB-\fRG.
.RE

.sp
.ne 2
.na
\fB\fBgmacs\fR\fR
.ad
.RS 15n
Enables or disables \fBgmacs\fR. \fBgmacs\fR editing mode is the same as
\fBemacs\fR editing mode, except for the handling of CTRL-T.
.RE

.sp
.ne 2
.na
\fB\fBhistexpand\fR\fR
.ad
.RS 15n
Same as \fB-H\fR.
.RE

.sp
.ne 2
.na
\fB\fBignoreeof\fR\fR
.ad
.RS 15n
The interactive shell does not exit on end-of-file.
.RE

.sp
.ne 2
.na
\fB\fBkeyword\fR\fR
.ad
.RS 15n
Same as \fB-k\fR.
.RE

.sp
.ne 2
.na
\fB\fBmarkdirs\fR\fR
.ad
.RS 15n
All directory names resulting from file name generation have a trailing \fB/\fR
appended.
.RE

.sp
.ne 2
.na
\fB\fBmonitor\fR\fR
.ad
.RS 15n
Same as \fB-m\fR.
.RE

.sp
.ne 2
.na
\fB\fBmultiline\fR\fR
.ad
.RS 15n
Use multiple lines when editing lines that are longer than the window width.
.RE

.sp
.ne 2
.na
\fB\fBnoclobber\fR\fR
.ad
.RS 15n
Same as \fB-C\fR.
.RE

.sp
.ne 2
.na
\fB\fBnoexec\fR\fR
.ad
.RS 15n
Same as \fB-n\fR.
.RE

.sp
.ne 2
.na
\fB\fBnoglob\fR\fR
.ad
.RS 15n
Same as \fB-f\fR.
.RE

.sp
.ne 2
.na
\fB\fBnolog\fR\fR
.ad
.RS 15n
This has no effect. It is provided for backward compatibility.
.RE

.sp
.ne 2
.na
\fB\fBnotify\fR\fR
.ad
.RS 15n
Same as \fB-b\fR.
.RE

.sp
.ne 2
.na
\fB\fBnounset\fR\fR
.ad
.RS 15n
Same as \fB-u\fR.
.RE

.sp
.ne 2
.na
\fB\fBpipefail\fR\fR
.ad
.RS 15n
A pipeline does not complete until all components of the pipeline have
completed, and the exit status of the pipeline is the value of the last command
to exit with \fBnon-zero\fR exit status, or is \fBzero\fR if all commands
return zero exit status.
.RE

.sp
.ne 2
.na
\fB\fBprivileged\fR\fR
.ad
.RS 15n
Same as \fB-p\fR.
.RE

.sp
.ne 2
.na
\fB\fBshowme\fR\fR
.ad
.RS 15n
Simple commands preceded by a ; are traced as if \fB-x\fR were enabled but not
executed.
.RE

.sp
.ne 2
.na
\fB\fBtrackall\fR\fR
.ad
.RS 15n
Same as \fB-h\fR.
.RE

.sp
.ne 2
.na
\fB\fBverbose\fR\fR
.ad
.RS 15n
Same as \fB-v\fR.
.RE

.sp
.ne 2
.na
\fB\fBvi\fR\fR
.ad
.RS 15n
Enables or disables \fBvi\fR editing mode.
.RE

.sp
.ne 2
.na
\fB\fBviraw\fR\fR
.ad
.RS 15n
Does not use canonical input mode when using vi edit mode
.RE

.sp
.ne 2
.na
\fB\fBxtrace\fR\fR
.ad
.RS 15n
Same as \fB-x\fR.
.RE

.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 15n
Privileged mode. Disabling \fB-p\fR sets the effective user id to the real user
id, and the effective group id to the real group id. Enabling \fB-p\fR restores
the effective user and group ids to their values when the shell was invoked.
The \fB-p\fR option is on whenever the real and effective user id is not equal
or the real and effective group id is not equal. User profiles are not
processed when \fB-p\fR is enabled.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 15n
Restricted. Enables restricted shell. This option cannot be unset once enabled.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 15n
Sort the positional parameters
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 15n
Obsolete. The shell reads one command and then exits.
.RE

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.RS 15n
If enabled, the shell displays an error message when it tries to expand a
variable that is unset.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 15n
Verbose. The shell displays its input onto standard error as it reads it.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 15n
Execution trace. The shell displays each command after all expansion and before
execution preceded by the expanded value of the \fBPS4\fR parameter.
.RE

.sp
.LP
The following exit values are returned by \fBset\fR in \fBksh93\fR:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.sp
.LP
For each name specified, \fBunset\fR unsets the variable, or function if
\fB-f\fR is specified, from the current shell execution environment. Read-only
variables cannot be unset.
.sp
.LP
The options for \fBunset\fR in \fBksh93\fR are:
.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
Where \fIname\fR refers to a function name, the shell unsets the function
definition.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
If \fIname\fR refers to variable that is a reference, the variable \fIname\fR
is unset rather than the variable it references. Otherwise, this option is
equivalent to the \fB-v\fR option.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
Where \fIname\fR refers to a variable name, the shell unsets it and removes it
from the environment. This is the default behavior.
.RE

.sp
.LP
The following exit values are returned by \fBunset\fR in \fBksh93\fR:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion. All names were successfully unset.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred, or one or more \fIname\fR operands could not be unset
.RE

.sp
.LP
\fBexport\fR sets the export attribute on each of the variables specified by
name which causes them to be in the environment of subsequently executed
commands. If \fB=\fR\fIvalue\fR is specified, the variable \fIname\fR is set to
\fIvalue\fR.
.sp
.LP
If no \fIname\fR is specified, the names and values of all exported variables
are written to standard output.
.sp
.LP
\fBexport\fR is built-in to the shell as a declaration command so that field
splitting and pathname expansion are not performed on the arguments. Tilde
expansion occurs on value.
.sp
.LP
The options for \fBexport\fR in \fBksh93\fR are:
.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
Causes the output to be in the form of \fBexport\fR commands that can be used
as input to the shell to recreate the current exports.
.RE

.sp
.LP
The following exit values are returned by \fBexport\fR in \fBksh93\fR:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.sp
.LP
On this manual page, \fBksh93\fR(1) commands that are preceded by one or two
\fB+\fR are treated specially in the following ways:
.RS +4
.TP
1.
Variable assignment lists preceding the command remain in effect when the
command completes.
.RE
.RS +4
.TP
2.
I/O redirections are processed after variable assignments.
.RE
.RS +4
.TP
3.
Errors cause a script that contains them to abort.
.RE
.RS +4
.TP
4.
They are not valid function names.
.RE
.RS +4
.TP
5.
Words, following a command preceded by \fB++\fR that are in the format of a
variable assignment, are expanded with the same rules as a variable assignment.
This means that tilde substitution is performed after the \fB=\fR sign and
field splitting and file name generation are not performed.
.RE
.SH EXAMPLES
.SS "csh"
.LP
The following example sets the \fBPATH\fR variable to search for files in the
\fB/bin\fR, \fB/usr/bin\fR, \fB/usr/sbin\fR, and \fB/usr/ucb/bin\fR
directories, in that order:
.sp
.in +2
.nf
setenv PATH "/bin:/usr/bin:/usr/sbin:usr/ucb/bin"
.fi
.in -2
.sp

.SH SEE ALSO
.LP
.BR csh (1),
.BR ksh (1),
.BR ksh93 (1),
.BR read (1),
.BR sh (1),
.BR typeset (1),
.BR attributes (7),
.BR environ (7)