-
Notifications
You must be signed in to change notification settings - Fork 0
/
mybash1
4894 lines (4359 loc) · 322 KB
/
mybash1
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
BASH(1) BASH(1)
NNAAMMEE
bash - GNU Bourne-Again SHell
SSYYNNOOPPSSIISS
bbaasshh [options] [file]
CCOOPPYYRRIIGGHHTT
Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc.
DDEESSCCRRIIPPTTIIOONN
BBaasshh is an sshh-compatible command language interpreter that executes
commands read from the standard input or from a file. BBaasshh also incor-
porates useful features from the _K_o_r_n and _C shells (kksshh and ccsshh).
BBaasshh is intended to be a conformant implementation of the Shell and
Utilities portion of the IEEE POSIX specification (IEEE Standard
1003.1). BBaasshh can be configured to be POSIX-conformant by default.
OOPPTTIIOONNSS
In addition to the single-character shell options documented in the
description of the sseett builtin command, bbaasshh interprets the following
options when it is invoked:
--cc _s_t_r_i_n_g If the --cc option is present, then commands are read from
_s_t_r_i_n_g. If there are arguments after the _s_t_r_i_n_g, they are
assigned to the positional parameters, starting with $$00.
--ii If the --ii option is present, the shell is _i_n_t_e_r_a_c_t_i_v_e.
--ll Make bbaasshh act as if it had been invoked as a login shell (see
IINNVVOOCCAATTIIOONN below).
--rr If the --rr option is present, the shell becomes _r_e_s_t_r_i_c_t_e_d
(see RREESSTTRRIICCTTEEDD SSHHEELLLL below).
--ss If the --ss option is present, or if no arguments remain after
option processing, then commands are read from the standard
input. This option allows the positional parameters to be
set when invoking an interactive shell.
--DD A list of all double-quoted strings preceded by $$ is printed
on the standard output. These are the strings that are sub-
ject to language translation when the current locale is not CC
or PPOOSSIIXX. This implies the --nn option; no commands will be
executed.
[[--++]]OO [[_s_h_o_p_t___o_p_t_i_o_n]]
_s_h_o_p_t___o_p_t_i_o_n is one of the shell options accepted by the
sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). If
_s_h_o_p_t___o_p_t_i_o_n is present, --OO sets the value of that option; ++OO
unsets it. If _s_h_o_p_t___o_p_t_i_o_n is not supplied, the names and
values of the shell options accepted by sshhoopptt are printed on
the standard output. If the invocation option is ++OO, the
output is displayed in a format that may be reused as input.
---- A ---- signals the end of options and disables further option
processing. Any arguments after the ---- are treated as file-
names and arguments. An argument of -- is equivalent to ----.
BBaasshh also interprets a number of multi-character options. These
options must appear on the command line before the single-character
options to be recognized.
----ddeebbuuggggeerr
Arrange for the debugger profile to be executed before the shell
starts. Turns on extended debugging mode (see the description
of the eexxttddeebbuugg option to the sshhoopptt builtin below) and shell
function tracing (see the description of the --oo ffuunnccttrraaccee option
to the sseett builtin below).
----dduummpp--ppoo--ssttrriinnggss
Equivalent to --DD, but the output is in the GNU _g_e_t_t_e_x_t ppoo
(portable object) file format.
----dduummpp--ssttrriinnggss
Equivalent to --DD.
----hheellpp Display a usage message on standard output and exit success-
fully.
----iinniitt--ffiillee _f_i_l_e
----rrccffiillee _f_i_l_e
Execute commands from _f_i_l_e instead of the standard personal ini-
tialization file _~_/_._b_a_s_h_r_c if the shell is interactive (see
IINNVVOOCCAATTIIOONN below).
----llooggiinn
Equivalent to --ll.
----nnooeeddiittiinngg
Do not use the GNU rreeaaddlliinnee library to read command lines when
the shell is interactive.
----nnoopprrooffiillee
Do not read either the system-wide startup file _/_e_t_c_/_p_r_o_f_i_l_e or
any of the personal initialization files _~_/_._b_a_s_h___p_r_o_f_i_l_e,
_~_/_._b_a_s_h___l_o_g_i_n, or _~_/_._p_r_o_f_i_l_e. By default, bbaasshh reads these
files when it is invoked as a login shell (see IINNVVOOCCAATTIIOONN
below).
----nnoorrcc Do not read and execute the personal initialization file
_~_/_._b_a_s_h_r_c if the shell is interactive. This option is on by
default if the shell is invoked as sshh.
----ppoossiixx
Change the behavior of bbaasshh where the default operation differs
from the POSIX standard to match the standard (_p_o_s_i_x _m_o_d_e).
----rreessttrriicctteedd
The shell becomes restricted (see RREESSTTRRIICCTTEEDD SSHHEELLLL below).
----rrppmm--rreeqquuiirreess
Produce the list of files that are required for the shell script
to run. This implies '-n' and is subject to the same limita-
tions as compile time error checking checking; Backticks, []
tests, and evals are not parsed so some dependencies may be
missed.
----vveerrbboossee
Equivalent to --vv.
----vveerrssiioonn
Show version information for this instance of bbaasshh on the stan-
dard output and exit successfully.
AARRGGUUMMEENNTTSS
If arguments remain after option processing, and neither the --cc nor the
--ss option has been supplied, the first argument is assumed to be the
name of a file containing shell commands. If bbaasshh is invoked in this
fashion, $$00 is set to the name of the file, and the positional parame-
ters are set to the remaining arguments. BBaasshh reads and executes com-
mands from this file, then exits. BBaasshh's exit status is the exit sta-
tus of the last command executed in the script. If no commands are
executed, the exit status is 0. An attempt is first made to open the
file in the current directory, and, if no file is found, then the shell
searches the directories in PPAATTHH for the script.
IINNVVOOCCAATTIIOONN
A _l_o_g_i_n _s_h_e_l_l is one whose first character of argument zero is a --, or
one started with the ----llooggiinn option.
An _i_n_t_e_r_a_c_t_i_v_e shell is one started without non-option arguments and
without the --cc option whose standard input and error are both connected
to terminals (as determined by _i_s_a_t_t_y(3)), or one started with the --ii
option. PPSS11 is set and $$-- includes ii if bbaasshh is interactive, allowing
a shell script or a startup file to test this state.
The following paragraphs describe how bbaasshh executes its startup files.
If any of the files exist but cannot be read, bbaasshh reports an error.
Tildes are expanded in file names as described below under TTiillddee EExxppaann--
ssiioonn in the EEXXPPAANNSSIIOONN section.
When bbaasshh is invoked as an interactive login shell, or as a non-inter-
active shell with the ----llooggiinn option, it first reads and executes com-
mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading
that file, it looks for _~_/_._b_a_s_h___p_r_o_f_i_l_e, _~_/_._b_a_s_h___l_o_g_i_n, and _~_/_._p_r_o_f_i_l_e,
in that order, and reads and executes commands from the first one that
exists and is readable. The ----nnoopprrooffiillee option may be used when the
shell is started to inhibit this behavior.
When a login shell exits, bbaasshh reads and executes commands from the
file _~_/_._b_a_s_h___l_o_g_o_u_t, if it exists.
When an interactive shell that is not a login shell is started, bbaasshh
reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. This
may be inhibited by using the ----nnoorrcc option. The ----rrccffiillee _f_i_l_e option
will force bbaasshh to read and execute commands from _f_i_l_e instead of
_~_/_._b_a_s_h_r_c.
When bbaasshh is started non-interactively, to run a shell script, for
example, it looks for the variable BBAASSHH__EENNVV in the environment, expands
its value if it appears there, and uses the expanded value as the name
of a file to read and execute. BBaasshh behaves as if the following com-
mand were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PPAATTHH variable is not used to search for the file
name.
If bbaasshh is invoked with the name sshh, it tries to mimic the startup
behavior of historical versions of sshh as closely as possible, while
conforming to the POSIX standard as well. When invoked as an interac-
tive login shell, or a non-interactive shell with the ----llooggiinn option,
it first attempts to read and execute commands from _/_e_t_c_/_p_r_o_f_i_l_e and
_~_/_._p_r_o_f_i_l_e, in that order. The ----nnoopprrooffiillee option may be used to
inhibit this behavior. When invoked as an interactive shell with the
name sshh, bbaasshh looks for the variable EENNVV, expands its value if it is
defined, and uses the expanded value as the name of a file to read and
execute. Since a shell invoked as sshh does not attempt to read and exe-
cute commands from any other startup files, the ----rrccffiillee option has no
effect. A non-interactive shell invoked with the name sshh does not
attempt to read any other startup files. When invoked as sshh, bbaasshh
enters _p_o_s_i_x mode after the startup files are read.
When bbaasshh is started in _p_o_s_i_x mode, as with the ----ppoossiixx command line
option, it follows the POSIX standard for startup files. In this mode,
interactive shells expand the EENNVV variable and commands are read and
executed from the file whose name is the expanded value. No other
startup files are read.
BBaasshh attempts to determine when it is being run by the remote shell
daemon, usually _r_s_h_d. If bbaasshh determines it is being run by _r_s_h_d, it
reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists and is
readable. It will not do this if invoked as sshh. The ----nnoorrcc option may
be used to inhibit this behavior, and the ----rrccffiillee option may be used
to force another file to be read, but _r_s_h_d does not generally invoke
the shell with those options or allow them to be specified.
If the shell is started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the SSHHEELLLLOOPPTTSS variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id. If the --pp option
is supplied at invocation, the startup behavior is the same, but the
effective user id is not reset.
DDEEFFIINNIITTIIOONNSS
The following definitions are used throughout the rest of this docu-
ment.
bbllaannkk A space or tab.
wwoorrdd A sequence of characters considered as a single unit by the
shell. Also known as a ttookkeenn.
nnaammee A _w_o_r_d consisting only of alphanumeric characters and under-
scores, and beginning with an alphabetic character or an under-
score. Also referred to as an iiddeennttiiffiieerr.
mmeettaacchhaarraacctteerr
A character that, when unquoted, separates words. One of the
following:
|| && ;; (( )) << >> ssppaaccee ttaabb
ccoonnttrrooll ooppeerraattoorr
A _t_o_k_e_n that performs a control function. It is one of the fol-
lowing symbols:
|||| && &&&& ;; ;;;; (( )) || <<nneewwlliinnee>>
RREESSEERRVVEEDD WWOORRDDSS
_R_e_s_e_r_v_e_d _w_o_r_d_s are words that have a special meaning to the shell. The
following words are recognized as reserved when unquoted and either the
first word of a simple command (see SSHHEELLLL GGRRAAMMMMAARR below) or the third
word of a ccaassee or ffoorr command:
!! ccaassee ddoo ddoonnee eelliiff eellssee eessaacc ffii ffoorr ffuunnccttiioonn iiff iinn sseelleecctt tthheenn uunnttiill
wwhhiillee {{ }} ttiimmee [[[[ ]]]]
SSHHEELLLL GGRRAAMMMMAARR
SSiimmppllee CCoommmmaannddss
A _s_i_m_p_l_e _c_o_m_m_a_n_d is a sequence of optional variable assignments fol-
lowed by bbllaannkk-separated words and redirections, and terminated by a
_c_o_n_t_r_o_l _o_p_e_r_a_t_o_r. The first word specifies the command to be executed,
and is passed as argument zero. The remaining words are passed as
arguments to the invoked command.
The return value of a _s_i_m_p_l_e _c_o_m_m_a_n_d is its exit status, or 128+_n if
the command is terminated by signal _n.
PPiippeelliinneess
A _p_i_p_e_l_i_n_e is a sequence of one or more commands separated by the char-
acter ||. The format for a pipeline is:
[ttiimmee [--pp]] [ ! ] _c_o_m_m_a_n_d [ || _c_o_m_m_a_n_d_2 ... ]
The standard output of _c_o_m_m_a_n_d is connected via a pipe to the standard
input of _c_o_m_m_a_n_d_2. This connection is performed before any redirec-
tions specified by the command (see RREEDDIIRREECCTTIIOONN below).
The return status of a pipeline is the exit status of the last command,
unless the ppiippeeffaaiill option is enabled. If ppiippeeffaaiill is enabled, the
pipeline's return status is the value of the last (rightmost) command
to exit with a non-zero status, or zero if all commands exit success-
fully. If the reserved word !! precedes a pipeline, the exit status of
that pipeline is the logical negation of the exit status as described
above. The shell waits for all commands in the pipeline to terminate
before returning a value.
If the ttiimmee reserved word precedes a pipeline, the elapsed as well as
user and system time consumed by its execution are reported when the
pipeline terminates. The --pp option changes the output format to that
specified by POSIX. The TTIIMMEEFFOORRMMAATT variable may be set to a format
string that specifies how the timing information should be displayed;
see the description of TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below.
Each command in a pipeline is executed as a separate process (i.e., in
a subshell).
LLiissttss
A _l_i_s_t is a sequence of one or more pipelines separated by one of the
operators ;;, &&, &&&&, or ||||, and optionally terminated by one of ;;, &&, or
<<nneewwlliinnee>>.
Of these list operators, &&&& and |||| have equal precedence, followed by ;;
and &&,, which have equal precedence.
A sequence of one or more newlines may appear in a _l_i_s_t instead of a
semicolon to delimit commands.
If a command is terminated by the control operator &&, the shell exe-
cutes the command in the _b_a_c_k_g_r_o_u_n_d in a subshell. The shell does not
wait for the command to finish, and the return status is 0. Commands
separated by a ;; are executed sequentially; the shell waits for each
command to terminate in turn. The return status is the exit status of
the last command executed.
The control operators &&&& and |||| denote AND lists and OR lists, respec-
tively. An AND list has the form
_c_o_m_m_a_n_d_1 &&&& _c_o_m_m_a_n_d_2
_c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d_1 returns an exit status
of zero.
An OR list has the form
_c_o_m_m_a_n_d_1 |||| _c_o_m_m_a_n_d_2
_c_o_m_m_a_n_d_2 is executed if and only if _c_o_m_m_a_n_d_1 returns a non-zero exit
status. The return status of AND and OR lists is the exit status of
the last command executed in the list.
CCoommppoouunndd CCoommmmaannddss
A _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d is one of the following:
(_l_i_s_t) _l_i_s_t is executed in a subshell environment (see CCOOMMMMAANNDD EEXXEECCUU--
TTIIOONN EENNVVIIRROONNMMEENNTT below). Variable assignments and builtin com-
mands that affect the shell's environment do not remain in
effect after the command completes. The return status is the
exit status of _l_i_s_t.
{ _l_i_s_t; }
_l_i_s_t is simply executed in the current shell environment. _l_i_s_t
must be terminated with a newline or semicolon. This is known
as a _g_r_o_u_p _c_o_m_m_a_n_d. The return status is the exit status of
_l_i_s_t. Note that unlike the metacharacters (( and )), {{ and }} are
_r_e_s_e_r_v_e_d _w_o_r_d_s and must occur where a reserved word is permitted
to be recognized. Since they do not cause a word break, they
must be separated from _l_i_s_t by whitespace.
((_e_x_p_r_e_s_s_i_o_n))
The _e_x_p_r_e_s_s_i_o_n is evaluated according to the rules described
below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If the value of the expres-
sion is non-zero, the return status is 0; otherwise the return
status is 1. This is exactly equivalent to lleett ""_e_x_p_r_e_s_s_i_o_n"".
[[[[ _e_x_p_r_e_s_s_i_o_n ]]]]
Return a status of 0 or 1 depending on the evaluation of the
conditional expression _e_x_p_r_e_s_s_i_o_n. Expressions are composed of
the primaries described below under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS.
Word splitting and pathname expansion are not performed on the
words between the [[[[ and ]]]]; tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution,
process substitution, and quote removal are performed. Condi-
tional operators such as --ff must be unquoted to be recognized as
primaries.
When the ==== and !!== operators are used, the string to the right
of the operator is considered a pattern and matched according to
the rules described below under PPaatttteerrnn MMaattcchhiinngg. If the shell
option nnooccaasseemmaattcchh is enabled, the match is performed without
regard to the case of alphabetic characters. The return value
is 0 if the string matches (====) or does not match (!!==) the pat-
tern, and 1 otherwise. Any part of the pattern may be quoted to
force it to be matched as a string.
An additional binary operator, ==~~, is available, with the same
precedence as ==== and !!==. When it is used, the string to the
right of the operator is considered an extended regular expres-
sion and matched accordingly (as in _r_e_g_e_x(3)). The return value
is 0 if the string matches the pattern, and 1 otherwise. If the
regular expression is syntactically incorrect, the conditional
expression's return value is 2. If the shell option nnooccaasseemmaattcchh
is enabled, the match is performed without regard to the case of
alphabetic characters. Substrings matched by parenthesized
subexpressions within the regular expression are saved in the
array variable BBAASSHH__RREEMMAATTCCHH. The element of BBAASSHH__RREEMMAATTCCHH with
index 0 is the portion of the string matching the entire regular
expression. The element of BBAASSHH__RREEMMAATTCCHH with index _n is the
portion of the string matching the _nth parenthesized subexpres-
sion.
Expressions may be combined using the following operators,
listed in decreasing order of precedence:
(( _e_x_p_r_e_s_s_i_o_n ))
Returns the value of _e_x_p_r_e_s_s_i_o_n. This may be used to
override the normal precedence of operators.
!! _e_x_p_r_e_s_s_i_o_n
True if _e_x_p_r_e_s_s_i_o_n is false.
_e_x_p_r_e_s_s_i_o_n_1 &&&& _e_x_p_r_e_s_s_i_o_n_2
True if both _e_x_p_r_e_s_s_i_o_n_1 and _e_x_p_r_e_s_s_i_o_n_2 are true.
_e_x_p_r_e_s_s_i_o_n_1 |||| _e_x_p_r_e_s_s_i_o_n_2
True if either _e_x_p_r_e_s_s_i_o_n_1 or _e_x_p_r_e_s_s_i_o_n_2 is true.
The &&&& and |||| operators do not evaluate _e_x_p_r_e_s_s_i_o_n_2 if the value
of _e_x_p_r_e_s_s_i_o_n_1 is sufficient to determine the return value of
the entire conditional expression.
ffoorr _n_a_m_e [ iinn _w_o_r_d ] ; ddoo _l_i_s_t ; ddoonnee
The list of words following iinn is expanded, generating a list of
items. The variable _n_a_m_e is set to each element of this list in
turn, and _l_i_s_t is executed each time. If the iinn _w_o_r_d is omit-
ted, the ffoorr command executes _l_i_s_t once for each positional
parameter that is set (see PPAARRAAMMEETTEERRSS below). The return status
is the exit status of the last command that executes. If the
expansion of the items following iinn results in an empty list, no
commands are executed, and the return status is 0.
ffoorr (( _e_x_p_r_1 ; _e_x_p_r_2 ; _e_x_p_r_3 )) ; ddoo _l_i_s_t ; ddoonnee
First, the arithmetic expression _e_x_p_r_1 is evaluated according to
the rules described below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. The
arithmetic expression _e_x_p_r_2 is then evaluated repeatedly until
it evaluates to zero. Each time _e_x_p_r_2 evaluates to a non-zero
value, _l_i_s_t is executed and the arithmetic expression _e_x_p_r_3 is
evaluated. If any expression is omitted, it behaves as if it
evaluates to 1. The return value is the exit status of the last
command in _l_i_s_t that is executed, or false if any of the expres-
sions is invalid.
sseelleecctt _n_a_m_e [ iinn _w_o_r_d ] ; ddoo _l_i_s_t ; ddoonnee
The list of words following iinn is expanded, generating a list of
items. The set of expanded words is printed on the standard
error, each preceded by a number. If the iinn _w_o_r_d is omitted,
the positional parameters are printed (see PPAARRAAMMEETTEERRSS below).
The PPSS33 prompt is then displayed and a line read from the stan-
dard input. If the line consists of a number corresponding to
one of the displayed words, then the value of _n_a_m_e is set to
that word. If the line is empty, the words and prompt are dis-
played again. If EOF is read, the command completes. Any other
value read causes _n_a_m_e to be set to null. The line read is
saved in the variable RREEPPLLYY. The _l_i_s_t is executed after each
selection until a bbrreeaakk command is executed. The exit status of
sseelleecctt is the exit status of the last command executed in _l_i_s_t,
or zero if no commands were executed.
ccaassee _w_o_r_d iinn [ [(] _p_a_t_t_e_r_n [ || _p_a_t_t_e_r_n ] ... ) _l_i_s_t ;; ] ... eessaacc
A ccaassee command first expands _w_o_r_d, and tries to match it against
each _p_a_t_t_e_r_n in turn, using the same matching rules as for path-
name expansion (see PPaatthhnnaammee EExxppaannssiioonn below). The _w_o_r_d is
expanded using tilde expansion, parameter and variable expan-
sion, arithmetic substitution, command substitution, process
substitution and quote removal. Each _p_a_t_t_e_r_n examined is
expanded using tilde expansion, parameter and variable expan-
sion, arithmetic substitution, command substitution, and process
substitution. If the shell option nnooccaasseemmaattcchh is enabled, the
match is performed without regard to the case of alphabetic
characters. When a match is found, the corresponding _l_i_s_t is
executed. After the first match, no subsequent matches are
attempted. The exit status is zero if no pattern matches. Oth-
erwise, it is the exit status of the last command executed in
_l_i_s_t.
iiff _l_i_s_t; tthheenn _l_i_s_t_; [ eelliiff _l_i_s_t; tthheenn _l_i_s_t; ] ... [ eellssee _l_i_s_t; ] ffii
The iiff _l_i_s_t is executed. If its exit status is zero, the tthheenn
_l_i_s_t is executed. Otherwise, each eelliiff _l_i_s_t is executed in
turn, and if its exit status is zero, the corresponding tthheenn
_l_i_s_t is executed and the command completes. Otherwise, the eellssee
_l_i_s_t is executed, if present. The exit status is the exit sta-
tus of the last command executed, or zero if no condition tested
true.
wwhhiillee _l_i_s_t; ddoo _l_i_s_t; ddoonnee
uunnttiill _l_i_s_t; ddoo _l_i_s_t; ddoonnee
The wwhhiillee command continuously executes the ddoo _l_i_s_t as long as
the last command in _l_i_s_t returns an exit status of zero. The
uunnttiill command is identical to the wwhhiillee command, except that the
test is negated; the ddoo _l_i_s_t is executed as long as the last
command in _l_i_s_t returns a non-zero exit status. The exit status
of the wwhhiillee and uunnttiill commands is the exit status of the last
ddoo _l_i_s_t command executed, or zero if none was executed.
SShheellll FFuunnccttiioonn DDeeffiinniittiioonnss
A shell function is an object that is called like a simple command and
executes a compound command with a new set of positional parameters.
Shell functions are declared as follows:
[ ffuunnccttiioonn ] _n_a_m_e () _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
This defines a function named _n_a_m_e. The reserved word ffuunnccttiioonn
is optional. If the ffuunnccttiioonn reserved word is supplied, the
parentheses are optional. The _b_o_d_y of the function is the com-
pound command _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d (see CCoommppoouunndd CCoommmmaannddss above).
That command is usually a _l_i_s_t of commands between { and }, but
may be any command listed under CCoommppoouunndd CCoommmmaannddss above. _c_o_m_-
_p_o_u_n_d_-_c_o_m_m_a_n_d is executed whenever _n_a_m_e is specified as the name
of a simple command. Any redirections (see RREEDDIIRREECCTTIIOONN below)
specified when a function is defined are performed when the
function is executed. The exit status of a function definition
is zero unless a syntax error occurs or a readonly function with
the same name already exists. When executed, the exit status of
a function is the exit status of the last command executed in
the body. (See FFUUNNCCTTIIOONNSS below.)
CCOOMMMMEENNTTSS
In a non-interactive shell, or an interactive shell in which the iinntteerr--
aaccttiivvee__ccoommmmeennttss option to the sshhoopptt builtin is enabled (see SSHHEELLLL
BBUUIILLTTIINN CCOOMMMMAANNDDSS below), a word beginning with ## causes that word and
all remaining characters on that line to be ignored. An interactive
shell without the iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not allow
comments. The iinntteerraaccttiivvee__ccoommmmeennttss option is on by default in interac-
tive shells.
QQUUOOTTIINNGG
_Q_u_o_t_i_n_g is used to remove the special meaning of certain characters or
words to the shell. Quoting can be used to disable special treatment
for special characters, to prevent reserved words from being recognized
as such, and to prevent parameter expansion.
Each of the _m_e_t_a_c_h_a_r_a_c_t_e_r_s listed above under DDEEFFIINNIITTIIOONNSS has special
meaning to the shell and must be quoted if it is to represent itself.
When the command history expansion facilities are being used (see HHIISS--
TTOORRYY EEXXPPAANNSSIIOONN below), the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, usually !!, must
be quoted to prevent history expansion.
There are three quoting mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single
quotes, and double quotes.
A non-quoted backslash (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r. It preserves the
literal value of the next character that follows, with the exception of
<newline>. If a \\<newline> pair appears, and the backslash is not
itself quoted, the \\<newline> is treated as a line continuation (that
is, it is removed from the input stream and effectively ignored).
Enclosing characters in single quotes preserves the literal value of
each character within the quotes. A single quote may not occur between
single quotes, even when preceded by a backslash.
Enclosing characters in double quotes preserves the literal value of
all characters within the quotes, with the exception of $$, '', \\, and,
when history expansion is enabled, !!. The characters $$ and '' retain
their special meaning within double quotes. The backslash retains its
special meaning only when followed by one of the following characters:
$$, '', "", \\, or <<nneewwlliinnee>>. A double quote may be quoted within double
quotes by preceding it with a backslash. If enabled, history expansion
will be performed unless an !! appearing in double quotes is escaped
using a backslash. The backslash preceding the !! is not removed.
The special parameters ** and @@ have special meaning when in double
quotes (see PPAARRAAMMEETTEERRSS below).
Words of the form $$'_s_t_r_i_n_g' are treated specially. The word expands to
_s_t_r_i_n_g, with backslash-escaped characters replaced as specified by the
ANSI C standard. Backslash escape sequences, if present, are decoded
as follows:
\\aa alert (bell)
\\bb backspace
\\ee an escape character
\\ff form feed
\\nn new line
\\rr carriage return
\\tt horizontal tab
\\vv vertical tab
\\\\ backslash
\\'' single quote
\\_n_n_n the eight-bit character whose value is the octal value
_n_n_n (one to three digits)
\\xx_H_H the eight-bit character whose value is the hexadecimal
value _H_H (one or two hex digits)
\\cc_x a control-_x character
The expanded result is single-quoted, as if the dollar sign had not
been present.
A double-quoted string preceded by a dollar sign ($$) will cause the
string to be translated according to the current locale. If the cur-
rent locale is CC or PPOOSSIIXX, the dollar sign is ignored. If the string
is translated and replaced, the replacement is double-quoted.
PPAARRAAMMEETTEERRSS
A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num-
ber, or one of the special characters listed below under SSppeecciiaall PPaarraamm--
eetteerrss. A _v_a_r_i_a_b_l_e is a parameter denoted by a _n_a_m_e. A variable has a
_v_a_l_u_e and zero or more _a_t_t_r_i_b_u_t_e_s. Attributes are assigned using the
ddeeccllaarree builtin command (see ddeeccllaarree below in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS).
A parameter is set if it has been assigned a value. The null string is
a valid value. Once a variable is set, it may be unset only by using
the uunnsseett builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
A _v_a_r_i_a_b_l_e may be assigned to by a statement of the form
_n_a_m_e=[_v_a_l_u_e]
If _v_a_l_u_e is not given, the variable is assigned the null string. All
_v_a_l_u_e_s undergo tilde expansion, parameter and variable expansion, com-
mand substitution, arithmetic expansion, and quote removal (see EEXXPPAANN--
SSIIOONN below). If the variable has its iinntteeggeerr attribute set, then _v_a_l_u_e
is evaluated as an arithmetic expression even if the $((...)) expansion
is not used (see AArriitthhmmeettiicc EExxppaannssiioonn below). Word splitting is not
performed, with the exception of ""$$@@"" as explained below under SSppeecciiaall
PPaarraammeetteerrss. Pathname expansion is not performed. Assignment state-
ments may also appear as arguments to the aalliiaass, ddeeccllaarree, ttyyppeesseett,
eexxppoorrtt, rreeaaddoonnllyy, and llooccaall builtin commands.
In the context where an assignment statement is assigning a value to a
shell variable or array index, the += operator can be used to append to
or add to the variable's previous value. When += is applied to a vari-
able for which the integer attribute has been set, _v_a_l_u_e is evaluated
as an arithmetic expression and added to the variable's current value,
which is also evaluated. When += is applied to an array variable using
compound assignment (see AArrrraayyss below), the variable's value is not
unset (as it is when using =), and new values are appended to the array
beginning at one greater than the array's maximum index. When applied
to a string-valued variable, _v_a_l_u_e is expanded and appended to the
variable's value.
PPoossiittiioonnaall PPaarraammeetteerrss
A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits,
other than the single digit 0. Positional parameters are assigned from
the shell's arguments when it is invoked, and may be reassigned using
the sseett builtin command. Positional parameters may not be assigned to
with assignment statements. The positional parameters are temporarily
replaced when a shell function is executed (see FFUUNNCCTTIIOONNSS below).
When a positional parameter consisting of more than a single digit is
expanded, it must be enclosed in braces (see EEXXPPAANNSSIIOONN below).
SSppeecciiaall PPaarraammeetteerrss
The shell treats several parameters specially. These parameters may
only be referenced; assignment to them is not allowed.
** Expands to the positional parameters, starting from one. When
the expansion occurs within double quotes, it expands to a sin-
gle word with the value of each parameter separated by the first
character of the IIFFSS special variable. That is, "$$**" is equiva-
lent to "$$11_c$$22_c......", where _c is the first character of the value
of the IIFFSS variable. If IIFFSS is unset, the parameters are sepa-
rated by spaces. If IIFFSS is null, the parameters are joined
without intervening separators.
@@ Expands to the positional parameters, starting from one. When
the expansion occurs within double quotes, each parameter
expands to a separate word. That is, "$$@@" is equivalent to "$$11"
"$$22" ... If the double-quoted expansion occurs within a word,
the expansion of the first parameter is joined with the
beginning part of the original word, and the expansion of the
last parameter is joined with the last part of the original
word. When there are no positional parameters, "$$@@" and $$@@
expand to nothing (i.e., they are removed).
## Expands to the number of positional parameters in decimal.
?? Expands to the status of the most recently executed foreground
pipeline.
-- Expands to the current option flags as specified upon invoca-
tion, by the sseett builtin command, or those set by the shell
itself (such as the --ii option).
$$ Expands to the process ID of the shell. In a () subshell, it
expands to the process ID of the current shell, not the sub-
shell.
!! Expands to the process ID of the most recently executed back-
ground (asynchronous) command.
00 Expands to the name of the shell or shell script. This is set
at shell initialization. If bbaasshh is invoked with a file of com-
mands, $$00 is set to the name of that file. If bbaasshh is started
with the --cc option, then $$00 is set to the first argument after
the string to be executed, if one is present. Otherwise, it is
set to the file name used to invoke bbaasshh, as given by argument
zero.
__ At shell startup, set to the absolute pathname used to invoke
the shell or shell script being executed as passed in the envi-
ronment or argument list. Subsequently, expands to the last
argument to the previous command, after expansion. Also set to
the full pathname used to invoke each command executed and
placed in the environment exported to that command. When check-
ing mail, this parameter holds the name of the mail file cur-
rently being checked.
SShheellll VVaarriiaabblleess
The following variables are set by the shell:
BBAASSHH Expands to the full file name used to invoke this instance of
bbaasshh.
BBAASSHH__AARRGGCC
An array variable whose values are the number of parameters in
each frame of the current bash execution call stack. The number
of parameters to the current subroutine (shell function or
script executed with .. or ssoouurrccee) is at the top of the stack.
When a subroutine is executed, the number of parameters passed
is pushed onto BBAASSHH__AARRGGCC. The shell sets BBAASSHH__AARRGGCC only when in
extended debugging mode (see the description of the eexxttddeebbuugg
option to the sshhoopptt builtin below)
BBAASSHH__AARRGGVV
An array variable containing all of the parameters in the cur-
rent bash execution call stack. The final parameter of the last
subroutine call is at the top of the stack; the first parameter
of the initial call is at the bottom. When a subroutine is exe-
cuted, the parameters supplied are pushed onto BBAASSHH__AARRGGVV. The
shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see
the description of the eexxttddeebbuugg option to the sshhoopptt builtin
below)
BBAASSHH__CCOOMMMMAANNDD
The command currently being executed or about to be executed,
unless the shell is executing a command as the result of a trap,
in which case it is the command executing at the time of the
trap.
BBAASSHH__EEXXEECCUUTTIIOONN__SSTTRRIINNGG
The command argument to the --cc invocation option.
BBAASSHH__LLIINNEENNOO
An array variable whose members are the line numbers in source
files corresponding to each member of FFUUNNCCNNAAMMEE.
$${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file where
$${{FFUUNNCCNNAAMMEE[[_$_i_f_P]]}} _w_a_s _c_a_l_l_e_d_. _T_h_e _c_o_r_r_e_s_p_o_n_d_i_n_g _s_o_u_r_c_e _f_i_l_e
_n_a_m_e _i_s $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}}.. UUssee LLIINNEENNOO ttoo oobbttaaiinn tthhee ccuurrrreenntt
lliinnee nnuummbbeerr..
BBAASSHH__RREEMMAATTCCHH
An array variable whose members are assigned by the ==~~ binary
operator to the [[[[ conditional command. The element with index
0 is the portion of the string matching the entire regular
expression. The element with index _n is the portion of the
string matching the _nth parenthesized subexpression. This vari-
able is read-only.
BBAASSHH__SSOOUURRCCEE
An array variable whose members are the source filenames corre-
sponding to the elements in the FFUUNNCCNNAAMMEE array variable.
BBAASSHH__SSUUBBSSHHEELLLL
Incremented by one each time a subshell or subshell environment
is spawned. The initial value is 0.
BBAASSHH__VVEERRSSIINNFFOO
A readonly array variable whose members hold version information
for this instance of bbaasshh. The values assigned to the array
members are as follows:
BBAASSHH__VVEERRSSIINNFFOO[[0]] The major version number (the _r_e_l_e_a_s_e).
BBAASSHH__VVEERRSSIINNFFOO[[1]] The minor version number (the _v_e_r_s_i_o_n).
BBAASSHH__VVEERRSSIINNFFOO[[2]] The patch level.
BBAASSHH__VVEERRSSIINNFFOO[[3]] The build version.
BBAASSHH__VVEERRSSIINNFFOO[[4]] The release status (e.g., _b_e_t_a_1).
BBAASSHH__VVEERRSSIINNFFOO[[5]] The value of MMAACCHHTTYYPPEE.
BBAASSHH__VVEERRSSIIOONN
Expands to a string describing the version of this instance of
bbaasshh.
CCOOMMPP__CCWWOORRDD
An index into $${{CCOOMMPP__WWOORRDDSS}} of the word containing the current
cursor position. This variable is available only in shell func-
tions invoked by the programmable completion facilities (see
PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
CCOOMMPP__LLIINNEE
The current command line. This variable is available only in
shell functions and external commands invoked by the pro-
grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
below).
CCOOMMPP__PPOOIINNTT
The index of the current cursor position relative to the begin-
ning of the current command. If the current cursor position is
at the end of the current command, the value of this variable is
equal to $${{##CCOOMMPP__LLIINNEE}}. This variable is available only in
shell functions and external commands invoked by the pro-
grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
below).
CCOOMMPP__WWOORRDDBBRREEAAKKSS
The set of characters that the Readline library treats as word
separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS
is unset, it loses its special properties, even if it is subse-
quently reset.
CCOOMMPP__WWOORRDDSS
An array variable (see AArrrraayyss below) consisting of the individ-
ual words in the current command line. The words are split on
shell metacharacters as the shell parser would separate them.
This variable is available only in shell functions invoked by
the programmable completion facilities (see PPrrooggrraammmmaabbllee CCoommppllee--
ttiioonn below).
DDIIRRSSTTAACCKK
An array variable (see AArrrraayyss below) containing the current con-
tents of the directory stack. Directories appear in the stack
in the order they are displayed by the ddiirrss builtin. Assigning
to members of this array variable may be used to modify directo-
ries already in the stack, but the ppuusshhdd and ppooppdd builtins must
be used to add and remove directories. Assignment to this vari-
able will not change the current directory. If DDIIRRSSTTAACCKK is
unset, it loses its special properties, even if it is subse-
quently reset.
EEUUIIDD Expands to the effective user ID of the current user, initial-
ized at shell startup. This variable is readonly.
FFUUNNCCNNAAMMEE
An array variable containing the names of all shell functions
currently in the execution call stack. The element with index 0
is the name of any currently-executing shell function. The bot-
tom-most element is "main". This variable exists only when a
shell function is executing. Assignments to FFUUNNCCNNAAMMEE have no
effect and return an error status. If FFUUNNCCNNAAMMEE is unset, it
loses its special properties, even if it is subsequently reset.
GGRROOUUPPSS An array variable containing the list of groups of which the
current user is a member. Assignments to GGRROOUUPPSS have no effect
and return an error status. If GGRROOUUPPSS is unset, it loses its
special properties, even if it is subsequently reset.
HHIISSTTCCMMDD
The history number, or index in the history list, of the current
command. If HHIISSTTCCMMDD is unset, it loses its special properties,
even if it is subsequently reset.
HHOOSSTTNNAAMMEE
Automatically set to the name of the current host.
HHOOSSTTTTYYPPEE
Automatically set to a string that uniquely describes the type
of machine on which bbaasshh is executing. The default is system-
dependent.
LLIINNEENNOO Each time this parameter is referenced, the shell substitutes a
decimal number representing the current sequential line number
(starting with 1) within a script or function. When not in a
script or function, the value substituted is not guaranteed to
be meaningful. If LLIINNEENNOO is unset, it loses its special proper-
ties, even if it is subsequently reset.
MMAACCHHTTYYPPEE
Automatically set to a string that fully describes the system
type on which bbaasshh is executing, in the standard GNU _c_p_u_-_c_o_m_-
_p_a_n_y_-_s_y_s_t_e_m format. The default is system-dependent.
OOLLDDPPWWDD The previous working directory as set by the ccdd command.
OOPPTTAARRGG The value of the last option argument processed by the ggeettooppttss
builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
OOPPTTIINNDD The index of the next argument to be processed by the ggeettooppttss
builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
OOSSTTYYPPEE Automatically set to a string that describes the operating sys-
tem on which bbaasshh is executing. The default is system-depen-
dent.
PPIIPPEESSTTAATTUUSS
An array variable (see AArrrraayyss below) containing a list of exit
status values from the processes in the most-recently-executed
foreground pipeline (which may contain only a single command).
PPPPIIDD The process ID of the shell's parent. This variable is read-
only.
PPWWDD The current working directory as set by the ccdd command.
RRAANNDDOOMM Each time this parameter is referenced, a random integer between
0 and 32767 is generated. The sequence of random numbers may be
initialized by assigning a value to RRAANNDDOOMM. If RRAANNDDOOMM is unset,
it loses its special properties, even if it is subsequently
reset.
RREEPPLLYY Set to the line of input read by the rreeaadd builtin command when
no arguments are supplied.
SSEECCOONNDDSS
Each time this parameter is referenced, the number of seconds
since shell invocation is returned. If a value is assigned to
SSEECCOONNDDSS, the value returned upon subsequent references is the
number of seconds since the assignment plus the value assigned.
If SSEECCOONNDDSS is unset, it loses its special properties, even if it
is subsequently reset.
SSHHEELLLLOOPPTTSS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the --oo option to the sseett
builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The options
appearing in SSHHEELLLLOOPPTTSS are those reported as _o_n by sseett --oo. If
this variable is in the environment when bbaasshh starts up, each
shell option in the list will be enabled before reading any
startup files. This variable is read-only.
SSHHLLVVLL Incremented by one each time an instance of bbaasshh is started.
UUIIDD Expands to the user ID of the current user, initialized at shell
startup. This variable is readonly.
The following variables are used by the shell. In some cases, bbaasshh
assigns a default value to a variable; these cases are noted below.
BBAASSHH__EENNVV
If this parameter is set when bbaasshh is executing a shell script,
its value is interpreted as a filename containing commands to
initialize the shell, as in _~_/_._b_a_s_h_r_c. The value of BBAASSHH__EENNVV is
subjected to parameter expansion, command substitution, and
arithmetic expansion before being interpreted as a file name.
PPAATTHH is not used to search for the resultant file name.
CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the ccdd command. A sample value is
".:~:/usr".
CCOOLLUUMMNNSS
Used by the sseelleecctt builtin command to determine the terminal
width when printing selection lists. Automatically set upon
receipt of a SIGWINCH.
CCOOMMPPRREEPPLLYY
An array variable from which bbaasshh reads the possible completions
generated by a shell function invoked by the programmable com-
pletion facility (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
EEMMAACCSS If bbaasshh finds this variable in the environment when the shell
starts with value "t", it assumes that the shell is running in
an emacs shell buffer and disables line editing.
FFCCEEDDIITT The default editor for the ffcc builtin command.
FFIIGGNNOORREE
A colon-separated list of suffixes to ignore when performing
filename completion (see RREEAADDLLIINNEE below). A filename whose suf-
fix matches one of the entries in FFIIGGNNOORREE is excluded from the
list of matched filenames. A sample value is ".o:~".
GGLLOOBBIIGGNNOORREE
A colon-separated list of patterns defining the set of filenames
to be ignored by pathname expansion. If a filename matched by a
pathname expansion pattern also matches one of the patterns in
GGLLOOBBIIGGNNOORREE, it is removed from the list of matches.
HHIISSTTCCOONNTTRROOLL
A colon-separated list of values controlling how commands are
saved on the history list. If the list of values includes
_i_g_n_o_r_e_s_p_a_c_e, lines which begin with a ssppaaccee character are not
saved in the history list. A value of _i_g_n_o_r_e_d_u_p_s causes lines
matching the previous history entry to not be saved. A value of
_i_g_n_o_r_e_b_o_t_h is shorthand for _i_g_n_o_r_e_s_p_a_c_e and _i_g_n_o_r_e_d_u_p_s. A value
of _e_r_a_s_e_d_u_p_s causes all previous lines matching the current line
to be removed from the history list before that line is saved.
Any value not in the above list is ignored. If HHIISSTTCCOONNTTRROOLL is
unset, or does not include a valid value, all lines read by the
shell parser are saved on the history list, subject to the value
of HHIISSTTIIGGNNOORREE. The second and subsequent lines of a multi-line
compound command are not tested, and are added to the history
regardless of the value of HHIISSTTCCOONNTTRROOLL.
HHIISSTTFFIILLEE
The name of the file in which command history is saved (see HHIISS--
TTOORRYY below). The default value is _~_/_._b_a_s_h___h_i_s_t_o_r_y. If unset,
the command history is not saved when an interactive shell
exits.
HHIISSTTFFIILLEESSIIZZEE
The maximum number of lines contained in the history file. When
this variable is assigned a value, the history file is trun-
cated, if necessary, by removing the oldest entries, to contain
no more than that number of lines. The default value is 500.
The history file is also truncated to this size after writing it
when an interactive shell exits.
HHIISSTTIIGGNNOORREE
A colon-separated list of patterns used to decide which command
lines should be saved on the history list. Each pattern is
anchored at the beginning of the line and must match the com-
plete line (no implicit '**' is appended). Each pattern is
tested against the line after the checks specified by HHIISSTTCCOONN--
TTRROOLL are applied. In addition to the normal shell pattern
matching characters, '&&' matches the previous history line. '&&'
may be escaped using a backslash; the backslash is removed
before attempting a match. The second and subsequent lines of a
multi-line compound command are not tested, and are added to the
history regardless of the value of HHIISSTTIIGGNNOORREE.
HHIISSTTSSIIZZEE
The number of commands to remember in the command history (see
HHIISSTTOORRYY below). The default value is 500.
HHIISSTTTTIIMMEEFFOORRMMAATT
If this variable is set and not null, its value is used as a
format string for _s_t_r_f_t_i_m_e(3) to print the time stamp associated
with each history entry displayed by the hhiissttoorryy builtin. If
this variable is set, time stamps are written to the history
file so they may be preserved across shell sessions.
HHOOMMEE The home directory of the current user; the default argument for
the ccdd builtin command. The value of this variable is also used
when performing tilde expansion.
HHOOSSTTFFIILLEE
Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s
that should be read when the shell needs to complete a hostname.
The list of possible hostname completions may be changed while
the shell is running; the next time hostname completion is
attempted after the value is changed, bbaasshh adds the contents of
the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has
no value, bbaasshh attempts to read _/_e_t_c_/_h_o_s_t_s to obtain the list of
possible hostname completions. When HHOOSSTTFFIILLEE is unset, the
hostname list is cleared.
IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting
after expansion and to split lines into words with the rreeaadd
builtin command. The default value is ''<space><tab><new-
line>''.
IIGGNNOORREEEEOOFF
Controls the action of an interactive shell on receipt of an EEOOFF
character as the sole input. If set, the value is the number of
consecutive EEOOFF characters which must be typed as the first
characters on an input line before bbaasshh exits. If the variable
exists but does not have a numeric value, or has no value, the
default value is 10. If it does not exist, EEOOFF signifies the
end of input to the shell.
IINNPPUUTTRRCC
The filename for the rreeaaddlliinnee startup file, overriding the
default of _~_/_._i_n_p_u_t_r_c (see RREEAADDLLIINNEE below).
LLAANNGG Used to determine the locale category for any category not
specifically selected with a variable starting with LLCC__.
LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__
variable specifying a locale category.
LLCC__CCOOLLLLAATTEE
This variable determines the collation order used when sorting
the results of pathname expansion, and determines the behavior
of range expressions, equivalence classes, and collating
sequences within pathname expansion and pattern matching.
LLCC__CCTTYYPPEE
This variable determines the interpretation of characters and
the behavior of character classes within pathname expansion and
pattern matching.
LLCC__MMEESSSSAAGGEESS
This variable determines the locale used to translate double-
quoted strings preceded by a $$.
LLCC__NNUUMMEERRIICC
This variable determines the locale category used for number
formatting.
LLIINNEESS Used by the sseelleecctt builtin command to determine the column
length for printing selection lists. Automatically set upon
receipt of a SIGWINCH.
MMAAIILL If this parameter is set to a file name and the MMAAIILLPPAATTHH vari-
able is not set, bbaasshh informs the user of the arrival of mail in
the specified file.
MMAAIILLCCHHEECCKK
Specifies how often (in seconds) bbaasshh checks for mail. The
default is 60 seconds. When it is time to check for mail, the
shell does so before displaying the primary prompt. If this