This repository was archived by the owner on Nov 20, 2024. It is now read-only.
forked from bminor/bash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuiltins.0
2083 lines (1907 loc) · 145 KB
/
builtins.0
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_BUILTINS(1) General Commands Manual BASH_BUILTINS(1)
NNAAMMEE
:, ., [, alias, bg, bind, break, builtin, caller, cd, command, compgen,
complete, compopt, continue, declare, dirs, disown, echo, enable, eval,
exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs,
kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read,
readarray, readonly, return, set, shift, shopt, source, suspend, test,
times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait -
bash built-in commands, see bbaasshh(1)
BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
Unless otherwise noted, each builtin command documented in this section
as accepting options preceded by -- accepts ---- to signify the end of the
options. The ::, ttrruuee, ffaallssee, and tteesstt/[[ builtins do not accept options
and do not treat ---- specially. The eexxiitt, llooggoouutt, rreettuurrnn, bbrreeaakk, ccoonn--
ttiinnuuee, lleett, and sshhiifftt builtins accept and process arguments beginning
with -- without requiring ----. Other builtins that accept arguments but
are not specified as accepting options interpret arguments beginning
with -- as invalid options and require ---- to prevent this interpreta-
tion.
:: [_a_r_g_u_m_e_n_t_s]
No effect; the command does nothing beyond expanding _a_r_g_u_m_e_n_t_s
and performing any specified redirections. The return status is
zero.
.. _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
ssoouurrccee _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
Read and execute commands from _f_i_l_e_n_a_m_e in the current shell en-
vironment and return the exit status of the last command exe-
cuted from _f_i_l_e_n_a_m_e. If _f_i_l_e_n_a_m_e does not contain a slash,
filenames in PPAATTHH are used to find the directory containing
_f_i_l_e_n_a_m_e, but _f_i_l_e_n_a_m_e does not need to be executable. The file
searched for in PPAATTHH need not be executable. When bbaasshh is not
in _p_o_s_i_x _m_o_d_e, it searches the current directory if no file is
found in PPAATTHH. If the ssoouurrcceeppaatthh option to the sshhoopptt builtin
command is turned off, the PPAATTHH is not searched. If any _a_r_g_u_-
_m_e_n_t_s are supplied, they become the positional parameters when
_f_i_l_e_n_a_m_e is executed. Otherwise the positional parameters are
unchanged. If the --TT option is enabled, .. inherits any trap on
DDEEBBUUGG; if it is not, any DDEEBBUUGG trap string is saved and restored
around the call to .., and .. unsets the DDEEBBUUGG trap while it exe-
cutes. If --TT is not set, and the sourced file changes the DDEEBBUUGG
trap, the new value is retained when .. completes. The return
status is the status of the last command exited within the
script (0 if no commands are executed), and false if _f_i_l_e_n_a_m_e is
not found or cannot be read.
aalliiaass [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
AAlliiaass with no arguments or with the --pp option prints the list of
aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When
arguments are supplied, an alias is defined for each _n_a_m_e whose
_v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word
to be checked for alias substitution when the alias is expanded.
For each _n_a_m_e in the argument list for which no _v_a_l_u_e is sup-
plied, the name and value of the alias is printed. AAlliiaass re-
turns true unless a _n_a_m_e is given for which no alias has been
defined.
bbgg [_j_o_b_s_p_e_c ...]
Resume each suspended job _j_o_b_s_p_e_c in the background, as if it
had been started with &&. If _j_o_b_s_p_e_c is not present, the shell's
notion of the _c_u_r_r_e_n_t _j_o_b is used. bbgg _j_o_b_s_p_e_c returns 0 unless
run when job control is disabled or, when run with job control
enabled, any specified _j_o_b_s_p_e_c was not found or was started
without job control.
bbiinndd [--mm _k_e_y_m_a_p] [--llppssvvPPSSVVXX]
bbiinndd [--mm _k_e_y_m_a_p] [--qq _f_u_n_c_t_i_o_n] [--uu _f_u_n_c_t_i_o_n] [--rr _k_e_y_s_e_q]
bbiinndd [--mm _k_e_y_m_a_p] --ff _f_i_l_e_n_a_m_e
bbiinndd [--mm _k_e_y_m_a_p] --xx _k_e_y_s_e_q:_s_h_e_l_l_-_c_o_m_m_a_n_d
bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_f_u_n_c_t_i_o_n_-_n_a_m_e
bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d
bbiinndd _r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d_-_l_i_n_e
Display current rreeaaddlliinnee key and function bindings, bind a key
sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee
variable. Each non-option argument is a command as it would ap-
pear in a rreeaaddlliinnee initialization file such as _._i_n_p_u_t_r_c, but
each binding or command must be passed as a separate argument;
e.g., '"\C-x\C-r": re-read-init-file'. Options, if supplied,
have the following meanings:
--mm _k_e_y_m_a_p
Use _k_e_y_m_a_p as the keymap to be affected by the subsequent
bindings. Acceptable _k_e_y_m_a_p names are _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_-
_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d,
and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d (_v_i_-_m_o_v_e
is also a synonym); _e_m_a_c_s is equivalent to _e_m_a_c_s_-_s_t_a_n_-
_d_a_r_d.
--ll List the names of all rreeaaddlliinnee functions.
--pp Display rreeaaddlliinnee function names and bindings in such a
way that they can be re-read.
--PP List current rreeaaddlliinnee function names and bindings.
--ss Display rreeaaddlliinnee key sequences bound to macros and the
strings they output in such a way that they can be re-
read.
--SS Display rreeaaddlliinnee key sequences bound to macros and the
strings they output.
--vv Display rreeaaddlliinnee variable names and values in such a way
that they can be re-read.
--VV List current rreeaaddlliinnee variable names and values.
--ff _f_i_l_e_n_a_m_e
Read key bindings from _f_i_l_e_n_a_m_e.
--qq _f_u_n_c_t_i_o_n
Query about which keys invoke the named _f_u_n_c_t_i_o_n.
--uu _f_u_n_c_t_i_o_n
Unbind all keys bound to the named _f_u_n_c_t_i_o_n.
--rr _k_e_y_s_e_q
Remove any current binding for _k_e_y_s_e_q.
--xx _k_e_y_s_e_q::_s_h_e_l_l_-_c_o_m_m_a_n_d
Cause _s_h_e_l_l_-_c_o_m_m_a_n_d to be executed whenever _k_e_y_s_e_q is en-
tered. When _s_h_e_l_l_-_c_o_m_m_a_n_d is executed, the shell sets
the RREEAADDLLIINNEE__LLIINNEE variable to the contents of the rreeaadd--
lliinnee line buffer and the RREEAADDLLIINNEE__PPOOIINNTT and RREEAADDLLIINNEE__MMAARRKK
variables to the current location of the insertion point
and the saved insertion point (the mark), respectively.
The shell assigns any numeric argument the user supplied
to the RREEAADDLLIINNEE__AARRGGUUMMEENNTT variable. If there was no argu-
ment, that variable is not set. If the executed command
changes the value of any of RREEAADDLLIINNEE__LLIINNEE, RREEAADD--
LLIINNEE__PPOOIINNTT, or RREEAADDLLIINNEE__MMAARRKK, those new values will be
reflected in the editing state.
--XX List all key sequences bound to shell commands and the
associated commands in a format that can be reused as in-
put.
The return value is 0 unless an unrecognized option is given or
an error occurred.
bbrreeaakk [_n]
Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is
specified, break _n levels. _n must be >= 1. If _n is greater
than the number of enclosing loops, all enclosing loops are ex-
ited. The return value is 0 unless _n is not greater than or
equal to 1.
bbuuiillttiinn _s_h_e_l_l_-_b_u_i_l_t_i_n [_a_r_g_u_m_e_n_t_s]
Execute the specified shell builtin, passing it _a_r_g_u_m_e_n_t_s, and
return its exit status. This is useful when defining a function
whose name is the same as a shell builtin, retaining the func-
tionality of the builtin within the function. The ccdd builtin is
commonly redefined this way. The return status is false if
_s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command.
ccaalllleerr [_e_x_p_r]
Returns the context of any active subroutine call (a shell func-
tion or a script executed with the .. or ssoouurrccee builtins). With-
out _e_x_p_r, ccaalllleerr displays the line number and source filename of
the current subroutine call. If a non-negative integer is sup-
plied as _e_x_p_r, ccaalllleerr displays the line number, subroutine name,
and source file corresponding to that position in the current
execution call stack. This extra information may be used, for
example, to print a stack trace. The current frame is frame 0.
The return value is 0 unless the shell is not executing a sub-
routine call or _e_x_p_r does not correspond to a valid position in
the call stack.
ccdd [--LL|[--PP [--ee]] [-@]] [_d_i_r]
Change the current directory to _d_i_r. if _d_i_r is not supplied,
the value of the HHOOMMEE shell variable is the default. The vari-
able CCDDPPAATTHH defines the search path for the directory containing
_d_i_r: each directory name in CCDDPPAATTHH is searched for _d_i_r. Alter-
native directory names in CCDDPPAATTHH are separated by a colon (:).
A null directory name in CCDDPPAATTHH is the same as the current di-
rectory, i.e., ``..''. If _d_i_r begins with a slash (/), then CCDD--
PPAATTHH is not used. The --PP option causes ccdd to use the physical
directory structure by resolving symbolic links while traversing
_d_i_r and before processing instances of _._. in _d_i_r (see also the
--PP option to the sseett builtin command); the --LL option forces sym-
bolic links to be followed by resolving the link after process-
ing instances of _._. in _d_i_r. If _._. appears in _d_i_r, it is pro-
cessed by removing the immediately previous pathname component
from _d_i_r, back to a slash or the beginning of _d_i_r. If the --ee
option is supplied with --PP, and the current working directory
cannot be successfully determined after a successful directory
change, ccdd will return an unsuccessful status. On systems that
support it, the --@@ option presents the extended attributes asso-
ciated with a file as a directory. An argument of -- is con-
verted to $$OOLLDDPPWWDD before the directory change is attempted. If
a non-empty directory name from CCDDPPAATTHH is used, or if -- is the
first argument, and the directory change is successful, the ab-
solute pathname of the new working directory is written to the
standard output. If the directory change is successful, ccdd sets
the value of the PPWWDD environment variable to the new directory
name, and sets the OOLLDDPPWWDD environment variable to the value of
the current working directory before the change. The return
value is true if the directory was successfully changed; false
otherwise.
ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...]
Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function
lookup. Only builtin commands or commands found in the PPAATTHH are
executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is
performed using a default value for PPAATTHH that is guaranteed to
find all of the standard utilities. If either the --VV or --vv op-
tion is supplied, a description of _c_o_m_m_a_n_d is printed. The --vv
option causes a single word indicating the command or filename
used to invoke _c_o_m_m_a_n_d to be displayed; the --VV option produces a
more verbose description. If the --VV or --vv option is supplied,
the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If
neither option is supplied and an error occurred or _c_o_m_m_a_n_d can-
not be found, the exit status is 127. Otherwise, the exit sta-
tus of the ccoommmmaanndd builtin is the exit status of _c_o_m_m_a_n_d.
ccoommppggeenn [_o_p_t_i_o_n] [_w_o_r_d]
Generate possible completion matches for _w_o_r_d according to the
_o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee
builtin with the exception of --pp and --rr, and write the matches
to the standard output. When using the --FF or --CC options, the
various shell variables set by the programmable completion fa-
cilities, while available, will not have useful values.
The matches will be generated in the same way as if the program-
mable completion code had generated them directly from a comple-
tion specification with the same flags. If _w_o_r_d is specified,
only those completions matching _w_o_r_d will be displayed.
The return value is true unless an invalid option is supplied,
or no matches were generated.
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--DDEEII] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_-
_p_a_t] [--WW _w_o_r_d_l_i_s_t]
[--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d] [--XX _f_i_l_t_e_r_p_a_t] [--PP _p_r_e_f_i_x] [--SS _s_u_f_-
_f_i_x] _n_a_m_e [_n_a_m_e _._._.]
ccoommpplleettee --pprr [--DDEEII] [_n_a_m_e ...]
Specify how arguments to each _n_a_m_e should be completed. If the
--pp option is supplied, or if no options are supplied, existing
completion specifications are printed in a way that allows them
to be reused as input. The --rr option removes a completion spec-
ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
pletion specifications. The --DD option indicates that other sup-
plied options and actions should apply to the ``default'' com-
mand completion; that is, completion attempted on a command for
which no completion has previously been defined. The --EE option
indicates that other supplied options and actions should apply
to ``empty'' command completion; that is, completion attempted
on a blank line. The --II option indicates that other supplied
options and actions should apply to completion on the initial
non-assignment word on the line, or after a command delimiter
such as ;; or ||, which is usually command name completion. If
multiple options are supplied, the --DD option takes precedence
over --EE, and both take precedence over --II. If any of --DD, --EE, or
--II are supplied, any other _n_a_m_e arguments are ignored; these
completions only apply to the case specified by the option.
The process of applying these completion specifications when
word completion is attempted is described in _b_a_s_h_(_1_).
Other options, if specified, have the following meanings. The
arguments to the --GG, --WW, and --XX options (and, if necessary, the
--PP and --SS options) should be quoted to protect them from expan-
sion before the ccoommpplleettee builtin is invoked.
--oo _c_o_m_p_-_o_p_t_i_o_n
The _c_o_m_p_-_o_p_t_i_o_n controls several aspects of the comp-
spec's behavior beyond the simple generation of comple-
tions. _c_o_m_p_-_o_p_t_i_o_n may be one of:
bbaasshhddeeffaauulltt
Perform the rest of the default bbaasshh completions
if the compspec generates no matches.
ddeeffaauulltt Use readline's default filename completion if
the compspec generates no matches.
ddiirrnnaammeess
Perform directory name completion if the comp-
spec generates no matches.
ffiilleennaammeess
Tell readline that the compspec generates file-
names, so it can perform any filename-specific
processing (like adding a slash to directory
names, quoting special characters, or suppress-
ing trailing spaces). Intended to be used with
shell functions.
nnooqquuoottee Tell readline not to quote the completed words
if they are filenames (quoting filenames is the
default).
nnoossoorrtt Tell readline not to sort the list of possible
completions alphabetically.
nnoossppaaccee Tell readline not to append a space (the de-
fault) to words completed at the end of the
line.
pplluussddiirrss
After any matches defined by the compspec are
generated, directory name completion is at-
tempted and any matches are added to the results
of the other actions.
--AA _a_c_t_i_o_n
The _a_c_t_i_o_n may be one of the following to generate a
list of possible completions:
aalliiaass Alias names. May also be specified as --aa.
aarrrraayyvvaarr
Array variable names.
bbiinnddiinngg RReeaaddlliinnee key binding names.
bbuuiillttiinn Names of shell builtin commands. May also be
specified as --bb.
ccoommmmaanndd Command names. May also be specified as --cc.
ddiirreeccttoorryy
Directory names. May also be specified as --dd.
ddiissaabblleedd
Names of disabled shell builtins.
eennaabblleedd Names of enabled shell builtins.
eexxppoorrtt Names of exported shell variables. May also be
specified as --ee.
ffiillee File names. May also be specified as --ff.
ffuunnccttiioonn
Names of shell functions.
ggrroouupp Group names. May also be specified as --gg.
hheellppttooppiicc
Help topics as accepted by the hheellpp builtin.
hhoossttnnaammee
Hostnames, as taken from the file specified by
the HHOOSSTTFFIILLEE shell variable.
jjoobb Job names, if job control is active. May also
be specified as --jj.
kkeeyywwoorrdd Shell reserved words. May also be specified as
--kk.
rruunnnniinngg Names of running jobs, if job control is active.
sseerrvviiccee Service names. May also be specified as --ss.
sseettoopptt Valid arguments for the --oo option to the sseett
builtin.
sshhoopptt Shell option names as accepted by the sshhoopptt
builtin.
ssiiggnnaall Signal names.
ssttooppppeedd Names of stopped jobs, if job control is active.
uusseerr User names. May also be specified as --uu.
vvaarriiaabbllee
Names of all shell variables. May also be spec-
ified as --vv.
--CC _c_o_m_m_a_n_d
_c_o_m_m_a_n_d is executed in a subshell environment, and its
output is used as the possible completions. Arguments
are passed as with the --FF option.
--FF _f_u_n_c_t_i_o_n
The shell function _f_u_n_c_t_i_o_n is executed in the current
shell environment. When the function is executed, the
first argument ($$11) is the name of the command whose ar-
guments are being completed, the second argument ($$22) is
the word being completed, and the third argument ($$33) is
the word preceding the word being completed on the cur-
rent command line. When it finishes, the possible com-
pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY
array variable.
--GG _g_l_o_b_p_a_t
The pathname expansion pattern _g_l_o_b_p_a_t is expanded to
generate the possible completions.
--PP _p_r_e_f_i_x
_p_r_e_f_i_x is added at the beginning of each possible com-
pletion after all other options have been applied.
--SS _s_u_f_f_i_x
_s_u_f_f_i_x is appended to each possible completion after all
other options have been applied.
--WW _w_o_r_d_l_i_s_t
The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS
special variable as delimiters, and each resultant word
is expanded. Shell quoting is honored within _w_o_r_d_l_i_s_t,
in order to provide a mechanism for the words to contain
shell metacharacters or characters in the value of IIFFSS.
The possible completions are the members of the resul-
tant list which match the word being completed.
--XX _f_i_l_t_e_r_p_a_t
_f_i_l_t_e_r_p_a_t is a pattern as used for pathname expansion.
It is applied to the list of possible completions gener-
ated by the preceding options and arguments, and each
completion matching _f_i_l_t_e_r_p_a_t is removed from the list.
A leading !! in _f_i_l_t_e_r_p_a_t negates the pattern; in this
case, any completion not matching _f_i_l_t_e_r_p_a_t is removed.
The return value is true unless an invalid option is supplied,
an option other than --pp or --rr is supplied without a _n_a_m_e argu-
ment, an attempt is made to remove a completion specification
for a _n_a_m_e for which no specification exists, or an error occurs
adding a completion specification.
ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEEII] [++oo _o_p_t_i_o_n] [_n_a_m_e]
Modify completion options for each _n_a_m_e according to the _o_p_-
_t_i_o_ns, or for the currently-executing completion if no _n_a_m_es are
supplied. If no _o_p_t_i_o_ns are given, display the completion op-
tions for each _n_a_m_e or the current completion. The possible
values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin de-
scribed above. The --DD option indicates that other supplied op-
tions should apply to the ``default'' command completion; that
is, completion attempted on a command for which no completion
has previously been defined. The --EE option indicates that other
supplied options should apply to ``empty'' command completion;
that is, completion attempted on a blank line. The --II option
indicates that other supplied options should apply to completion
on the initial non-assignment word on the line, or after a com-
mand delimiter such as ;; or ||, which is usually command name
completion.
The return value is true unless an invalid option is supplied,
an attempt is made to modify the options for a _n_a_m_e for which no
completion specification exists, or an output error occurs.
ccoonnttiinnuuee [_n]
Resume the next iteration of the enclosing ffoorr, wwhhiillee, uunnttiill, or
sseelleecctt loop. If _n is specified, resume at the _nth enclosing
loop. _n must be >= 1. If _n is greater than the number of en-
closing loops, the last enclosing loop (the ``top-level'' loop)
is resumed. The return value is 0 unless _n is not greater than
or equal to 1.
ddeeccllaarree [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
ttyyppeesseett [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
Declare variables and/or give them attributes. If no _n_a_m_es are
given then display the values of variables. The --pp option will
display the attributes and values of each _n_a_m_e. When --pp is used
with _n_a_m_e arguments, additional options, other than --ff and --FF,
are ignored. When --pp is supplied without _n_a_m_e arguments, it
will display the attributes and values of all variables having
the attributes specified by the additional options. If no other
options are supplied with --pp, ddeeccllaarree will display the at-
tributes and values of all shell variables. The --ff option will
restrict the display to shell functions. The --FF option inhibits
the display of function definitions; only the function name and
attributes are printed. If the eexxttddeebbuugg shell option is enabled
using sshhoopptt, the source file name and line number where each
_n_a_m_e is defined are displayed as well. The --FF option implies
--ff. The --gg option forces variables to be created or modified at
the global scope, even when ddeeccllaarree is executed in a shell func-
tion. It is ignored in all other cases. The --II option causes
local variables to inherit the attributes (except the _n_a_m_e_r_e_f
attribute) and value of any existing variable with the same _n_a_m_e
at a surrounding scope. If there is no existing variable, the
local variable is initially unset. The following options can be
used to restrict output to variables with the specified attri-
bute or to give variables attributes:
--aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss in
_b_a_s_h_(_1_)).
--AA Each _n_a_m_e is an associative array variable (see AArrrraayyss in
_b_a_s_h_(_1_)).
--ff Use function names only.
--ii The variable is treated as an integer; arithmetic evalua-
tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN in _b_a_s_h_(_1_)) is performed
when the variable is assigned a value.
--ll When the variable is assigned a value, all upper-case
characters are converted to lower-case. The upper-case
attribute is disabled.
--nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name
reference to another variable. That other variable is
defined by the value of _n_a_m_e. All references, assign-
ments, and attribute modifications to _n_a_m_e, except those
using or changing the --nn attribute itself, are performed
on the variable referenced by _n_a_m_e's value. The nameref
attribute cannot be applied to array variables.
--rr Make _n_a_m_es readonly. These names cannot then be assigned
values by subsequent assignment statements or unset.
--tt Give each _n_a_m_e the _t_r_a_c_e attribute. Traced functions in-
herit the DDEEBBUUGG and RREETTUURRNN traps from the calling shell.
The trace attribute has no special meaning for variables.
--uu When the variable is assigned a value, all lower-case
characters are converted to upper-case. The lower-case
attribute is disabled.
--xx Mark _n_a_m_es for export to subsequent commands via the en-
vironment.
Using `+' instead of `-' turns off the attribute instead, with
the exceptions that ++aa and ++AA may not be used to destroy array
variables and ++rr will not remove the readonly attribute. When
used in a function, ddeeccllaarree and ttyyppeesseett make each _n_a_m_e local, as
with the llooccaall command, unless the --gg option is supplied. If a
variable name is followed by =_v_a_l_u_e, the value of the variable
is set to _v_a_l_u_e. When using --aa or --AA and the compound assign-
ment syntax to create array variables, additional attributes do
not take effect until subsequent assignments. The return value
is 0 unless an invalid option is encountered, an attempt is made
to define a function using ``-f foo=bar'', an attempt is made to
assign a value to a readonly variable, an attempt is made to as-
sign a value to an array variable without using the compound as-
signment syntax (see AArrrraayyss in _b_a_s_h_(_1_)), one of the _n_a_m_e_s is not
a valid shell variable name, an attempt is made to turn off
readonly status for a readonly variable, an attempt is made to
turn off array status for an array variable, or an attempt is
made to display a non-existent function with --ff.
ddiirrss [[--ccllppvv]] [[++_n]] [[--_n]]
Without options, displays the list of currently remembered di-
rectories. The default display is on a single line with direc-
tory names separated by spaces. Directories are added to the
list with the ppuusshhdd command; the ppooppdd command removes entries
from the list. The current directory is always the first direc-
tory in the stack.
--cc Clears the directory stack by deleting all of the en-
tries.
--ll Produces a listing using full pathnames; the default
listing format uses a tilde to denote the home directory.
--pp Print the directory stack with one entry per line.
--vv Print the directory stack with one entry per line, pre-
fixing each entry with its index in the stack.
++_n Displays the _nth entry counting from the left of the list
shown by ddiirrss when invoked without options, starting with
zero.
--_n Displays the _nth entry counting from the right of the
list shown by ddiirrss when invoked without options, starting
with zero.
The return value is 0 unless an invalid option is supplied or _n
indexes beyond the end of the directory stack.
ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ... | _p_i_d ... ]
Without options, remove each _j_o_b_s_p_e_c from the table of active
jobs. If _j_o_b_s_p_e_c is not present, and neither the --aa nor the --rr
option is supplied, the _c_u_r_r_e_n_t _j_o_b is used. If the --hh option
is given, each _j_o_b_s_p_e_c is not removed from the table, but is
marked so that SSIIGGHHUUPP is not sent to the job if the shell re-
ceives a SSIIGGHHUUPP. If no _j_o_b_s_p_e_c is supplied, the --aa option means
to remove or mark all jobs; the --rr option without a _j_o_b_s_p_e_c ar-
gument restricts operation to running jobs. The return value is
0 unless a _j_o_b_s_p_e_c does not specify a valid job.
eecchhoo [--nneeEE] [_a_r_g ...]
Output the _a_r_gs, separated by spaces, followed by a newline.
The return status is 0 unless a write error occurs. If --nn is
specified, the trailing newline is suppressed. If the --ee option
is given, interpretation of the following backslash-escaped
characters is enabled. The --EE option disables the interpreta-
tion of these escape characters, even on systems where they are
interpreted by default. The xxppgg__eecchhoo shell option may be used
to dynamically determine whether or not eecchhoo expands these es-
cape characters by default. eecchhoo does not interpret ---- to mean
the end of options. eecchhoo interprets the following escape se-
quences:
\\aa alert (bell)
\\bb backspace
\\cc suppress further output
\\ee
\\EE an escape character
\\ff form feed
\\nn new line
\\rr carriage return
\\tt horizontal tab
\\vv vertical tab
\\\\ backslash
\\00_n_n_n the eight-bit character whose value is the octal value
_n_n_n (zero to three octal digits)
\\xx_H_H the eight-bit character whose value is the hexadecimal
value _H_H (one or two hex digits)
\\uu_H_H_H_H the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _H_H_H_H (one to four hex digits)
\\UU_H_H_H_H_H_H_H_H
the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits)
eennaabbllee [--aa] [--ddnnppss] [--ff _f_i_l_e_n_a_m_e] [_n_a_m_e ...]
Enable and disable builtin shell commands. Disabling a builtin
allows a disk command which has the same name as a shell builtin
to be executed without specifying a full pathname, even though
the shell normally searches for builtins before disk commands.
If --nn is used, each _n_a_m_e is disabled; otherwise, _n_a_m_e_s are en-
abled. For example, to use the tteesstt binary found via the PPAATTHH
instead of the shell builtin version, run ``enable -n test''.
The --ff option means to load the new builtin command _n_a_m_e from
shared object _f_i_l_e_n_a_m_e, on systems that support dynamic loading.
Bash will use the value of the BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH variable as a
colon-separated list of directories in which to search for _f_i_l_e_-
_n_a_m_e. The default is system-dependent. The --dd option will
delete a builtin previously loaded with --ff. If no _n_a_m_e argu-
ments are given, or if the --pp option is supplied, a list of
shell builtins is printed. With no other option arguments, the
list consists of all enabled shell builtins. If --nn is supplied,
only disabled builtins are printed. If --aa is supplied, the list
printed includes all builtins, with an indication of whether or
not each is enabled. If --ss is supplied, the output is re-
stricted to the POSIX _s_p_e_c_i_a_l builtins. If no options are sup-
plied and a _n_a_m_e is not a shell builtin, eennaabbllee will attempt to
load _n_a_m_e from a shared object named _n_a_m_e, as if the command
were ``enable -f _n_a_m_e _n_a_m_e . The return value is 0 unless a
_n_a_m_e is not a shell builtin or there is an error loading a new
builtin from a shared object.
eevvaall [_a_r_g ...]
The _a_r_gs are read and concatenated together into a single com-
mand. This command is then read and executed by the shell, and
its exit status is returned as the value of eevvaall. If there are
no _a_r_g_s, or only null arguments, eevvaall returns 0.
eexxeecc [--ccll] [--aa _n_a_m_e] [_c_o_m_m_a_n_d [_a_r_g_u_m_e_n_t_s]]
If _c_o_m_m_a_n_d is specified, it replaces the shell. No new process
is created. The _a_r_g_u_m_e_n_t_s become the arguments to _c_o_m_m_a_n_d. If
the --ll option is supplied, the shell places a dash at the begin-
ning of the zeroth argument passed to _c_o_m_m_a_n_d. This is what _l_o_-
_g_i_n(1) does. The --cc option causes _c_o_m_m_a_n_d to be executed with
an empty environment. If --aa is supplied, the shell passes _n_a_m_e
as the zeroth argument to the executed command. If _c_o_m_m_a_n_d can-
not be executed for some reason, a non-interactive shell exits,
unless the eexxeeccffaaiill shell option is enabled. In that case, it
returns failure. An interactive shell returns failure if the
file cannot be executed. A subshell exits unconditionally if
eexxeecc fails. If _c_o_m_m_a_n_d is not specified, any redirections take
effect in the current shell, and the return status is 0. If
there is a redirection error, the return status is 1.
eexxiitt [_n]
Cause the shell to exit with a status of _n. If _n is omitted,
the exit status is that of the last command executed. A trap on
EEXXIITT is executed before the shell terminates.
eexxppoorrtt [--ffnn] [_n_a_m_e[=_w_o_r_d]] ...
eexxppoorrtt --pp
The supplied _n_a_m_e_s are marked for automatic export to the envi-
ronment of subsequently executed commands. If the --ff option is
given, the _n_a_m_e_s refer to functions. If no _n_a_m_e_s are given, or
if the --pp option is supplied, a list of names of all exported
variables is printed. The --nn option causes the export property
to be removed from each _n_a_m_e. If a variable name is followed by
=_w_o_r_d, the value of the variable is set to _w_o_r_d. eexxppoorrtt returns
an exit status of 0 unless an invalid option is encountered, one
of the _n_a_m_e_s is not a valid shell variable name, or --ff is sup-
plied with a _n_a_m_e that is not a function.
ffcc [--ee _e_n_a_m_e] [--llnnrr] [_f_i_r_s_t] [_l_a_s_t]
ffcc --ss [_p_a_t=_r_e_p] [_c_m_d]
The first form selects a range of commands from _f_i_r_s_t to _l_a_s_t
from the history list and displays or edits and re-executes
them. _F_i_r_s_t and _l_a_s_t may be specified as a string (to locate
the last command beginning with that string) or as a number (an
index into the history list, where a negative number is used as
an offset from the current command number). When listing, a
_f_i_r_s_t or _l_a_s_t of 0 is equivalent to -1 and -0 is equivalent to
the current command (usually the ffcc command); otherwise 0 is
equivalent to -1 and -0 is invalid. If _l_a_s_t is not specified,
it is set to the current command for listing (so that ``fc -l
-10'' prints the last 10 commands) and to _f_i_r_s_t otherwise. If
_f_i_r_s_t is not specified, it is set to the previous command for
editing and -16 for listing.
The --nn option suppresses the command numbers when listing. The
--rr option reverses the order of the commands. If the --ll option
is given, the commands are listed on standard output. Other-
wise, the editor given by _e_n_a_m_e is invoked on a file containing
those commands. If _e_n_a_m_e is not given, the value of the FFCCEEDDIITT
variable is used, and the value of EEDDIITTOORR if FFCCEEDDIITT is not set.
If neither variable is set, _v_i is used. When editing is com-
plete, the edited commands are echoed and executed.
In the second form, _c_o_m_m_a_n_d is re-executed after each instance
of _p_a_t is replaced by _r_e_p. _C_o_m_m_a_n_d is interpreted the same as
_f_i_r_s_t above. A useful alias to use with this is ``r="fc -s"'',
so that typing ``r cc'' runs the last command beginning with
``cc'' and typing ``r'' re-executes the last command.
If the first form is used, the return value is 0 unless an in-
valid option is encountered or _f_i_r_s_t or _l_a_s_t specify history
lines out of range. If the --ee option is supplied, the return
value is the value of the last command executed or failure if an
error occurs with the temporary file of commands. If the second
form is used, the return status is that of the command re-exe-
cuted, unless _c_m_d does not specify a valid history line, in
which case ffcc returns failure.
ffgg [_j_o_b_s_p_e_c]
Resume _j_o_b_s_p_e_c in the foreground, and make it the current job.
If _j_o_b_s_p_e_c is not present, the shell's notion of the _c_u_r_r_e_n_t _j_o_b
is used. The return value is that of the command placed into
the foreground, or failure if run when job control is disabled
or, when run with job control enabled, if _j_o_b_s_p_e_c does not spec-
ify a valid job or _j_o_b_s_p_e_c specifies a job that was started
without job control.
ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [_a_r_g _._._.]
ggeettooppttss is used by shell procedures to parse positional parame-
ters. _o_p_t_s_t_r_i_n_g contains the option characters to be recog-
nized; if a character is followed by a colon, the option is ex-
pected to have an argument, which should be separated from it by
white space. The colon and question mark characters may not be
used as option characters. Each time it is invoked, ggeettooppttss
places the next option in the shell variable _n_a_m_e, initializing
_n_a_m_e if it does not exist, and the index of the next argument to
be processed into the variable OOPPTTIINNDD. OOPPTTIINNDD is initialized to
1 each time the shell or a shell script is invoked. When an op-
tion requires an argument, ggeettooppttss places that argument into the
variable OOPPTTAARRGG. The shell does not reset OOPPTTIINNDD automatically;
it must be manually reset between multiple calls to ggeettooppttss
within the same shell invocation if a new set of parameters is
to be used.
When the end of options is encountered, ggeettooppttss exits with a re-
turn value greater than zero. OOPPTTIINNDD is set to the index of the
first non-option argument, and _n_a_m_e is set to ?.
ggeettooppttss normally parses the positional parameters, but if more
arguments are supplied as _a_r_g values, ggeettooppttss parses those in-
stead.
ggeettooppttss can report errors in two ways. If the first character
of _o_p_t_s_t_r_i_n_g is a colon, _s_i_l_e_n_t error reporting is used. In
normal operation, diagnostic messages are printed when invalid
options or missing option arguments are encountered. If the
variable OOPPTTEERRRR is set to 0, no error messages will be dis-
played, even if the first character of _o_p_t_s_t_r_i_n_g is not a colon.
If an invalid option is seen, ggeettooppttss places ? into _n_a_m_e and, if
not silent, prints an error message and unsets OOPPTTAARRGG. If
ggeettooppttss is silent, the option character found is placed in OOPP--
TTAARRGG and no diagnostic message is printed.
If a required argument is not found, and ggeettooppttss is not silent,
a question mark (??) is placed in _n_a_m_e, OOPPTTAARRGG is unset, and a
diagnostic message is printed. If ggeettooppttss is silent, then a
colon (::) is placed in _n_a_m_e and OOPPTTAARRGG is set to the option
character found.
ggeettooppttss returns true if an option, specified or unspecified, is
found. It returns false if the end of options is encountered or
an error occurs.
hhaasshh [--llrr] [--pp _f_i_l_e_n_a_m_e] [--ddtt] [_n_a_m_e]
Each time hhaasshh is invoked, the full pathname of the command _n_a_m_e
is determined by searching the directories in $$PPAATTHH and remem-
bered. Any previously-remembered pathname is discarded. If the
--pp option is supplied, no path search is performed, and _f_i_l_e_n_a_m_e
is used as the full filename of the command. The --rr option
causes the shell to forget all remembered locations. The --dd op-
tion causes the shell to forget the remembered location of each
_n_a_m_e. If the --tt option is supplied, the full pathname to which
each _n_a_m_e corresponds is printed. If multiple _n_a_m_e arguments
are supplied with --tt, the _n_a_m_e is printed before the hashed full
pathname. The --ll option causes output to be displayed in a for-
mat that may be reused as input. If no arguments are given, or
if only --ll is supplied, information about remembered commands is
printed. The return status is true unless a _n_a_m_e is not found
or an invalid option is supplied.
hheellpp [--ddmmss] [_p_a_t_t_e_r_n]
Display helpful information about builtin commands. If _p_a_t_t_e_r_n
is specified, hheellpp gives detailed help on all commands matching
_p_a_t_t_e_r_n; otherwise help for all the builtins and shell control
structures is printed.
--dd Display a short description of each _p_a_t_t_e_r_n
--mm Display the description of each _p_a_t_t_e_r_n in a manpage-like
format
--ss Display only a short usage synopsis for each _p_a_t_t_e_r_n
The return status is 0 unless no command matches _p_a_t_t_e_r_n.
hhiissttoorryy [[_n]]
hhiissttoorryy --cc
hhiissttoorryy --dd _o_f_f_s_e_t
hhiissttoorryy --dd _s_t_a_r_t-_e_n_d
hhiissttoorryy --aannrrww [_f_i_l_e_n_a_m_e]
hhiissttoorryy --pp _a_r_g [_a_r_g _._._.]
hhiissttoorryy --ss _a_r_g [_a_r_g _._._.]
With no options, display the command history list with line num-
bers. Lines listed with a ** have been modified. An argument of
_n lists only the last _n lines. If the shell variable HHIISSTTTTIIMMEE--
FFOORRMMAATT is set and not null, it is used as a format string for
_s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis-
played history entry. No intervening blank is printed between
the formatted time stamp and the history line. If _f_i_l_e_n_a_m_e is
supplied, it is used as the name of the history file; if not,
the value of HHIISSTTFFIILLEE is used. Options, if supplied, have the
following meanings:
--cc Clear the history list by deleting all the entries.
--dd _o_f_f_s_e_t
Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t
is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count
back from the end of the history, and an index of -1
refers to the current hhiissttoorryy --dd command.
--dd _s_t_a_r_t-_e_n_d
Delete the range of history entries between positions
_s_t_a_r_t and _e_n_d, inclusive. Positive and negative values
for _s_t_a_r_t and _e_n_d are interpreted as described above.
--aa Append the ``new'' history lines to the history file.
These are history lines entered since the beginning of
the current bbaasshh session, but not already appended to the
history file.
--nn Read the history lines not already read from the history
file into the current history list. These are lines ap-
pended to the history file since the beginning of the
current bbaasshh session.
--rr Read the contents of the history file and append them to
the current history list.
--ww Write the current history list to the history file, over-
writing the history file's contents.
--pp Perform history substitution on the following _a_r_g_s and
display the result on the standard output. Does not
store the results in the history list. Each _a_r_g must be
quoted to disable normal history expansion.
--ss Store the _a_r_g_s in the history list as a single entry.
The last command in the history list is removed before
the _a_r_g_s are added.
If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa-
tion associated with each history entry is written to the his-
tory file, marked with the history comment character. When the
history file is read, lines beginning with the history comment
character followed immediately by a digit are interpreted as
timestamps for the following history entry. The return value is
0 unless an invalid option is encountered, an error occurs while
reading or writing the history file, an invalid _o_f_f_s_e_t or range
is supplied as an argument to --dd, or the history expansion sup-
plied as an argument to --pp fails.
jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ]
jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ]
The first form lists the active jobs. The options have the fol-
lowing meanings:
--ll List process IDs in addition to the normal information.
--nn Display information only about jobs that have changed
status since the user was last notified of their status.
--pp List only the process ID of the job's process group
leader.
--rr Display only running jobs.
--ss Display only stopped jobs.
If _j_o_b_s_p_e_c is given, output is restricted to information about
that job. The return status is 0 unless an invalid option is
encountered or an invalid _j_o_b_s_p_e_c is supplied.
If the --xx option is supplied, jjoobbss replaces any _j_o_b_s_p_e_c found in
_c_o_m_m_a_n_d or _a_r_g_s with the corresponding process group ID, and ex-
ecutes _c_o_m_m_a_n_d passing it _a_r_g_s, returning its exit status.
kkiillll [--ss _s_i_g_s_p_e_c | --nn _s_i_g_n_u_m | --_s_i_g_s_p_e_c] [_p_i_d | _j_o_b_s_p_e_c] ...
kkiillll --ll|--LL [_s_i_g_s_p_e_c | _e_x_i_t___s_t_a_t_u_s]
Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes
named by _p_i_d or _j_o_b_s_p_e_c. _s_i_g_s_p_e_c is either a case-insensitive
signal name such as SSIIGGKKIILLLL (with or without the SSIIGG prefix) or
a signal number; _s_i_g_n_u_m is a signal number. If _s_i_g_s_p_e_c is not
present, then SSIIGGTTEERRMM is assumed. An argument of --ll lists the
signal names. If any arguments are supplied when --ll is given,
the names of the signals corresponding to the arguments are
listed, and the return status is 0. The _e_x_i_t___s_t_a_t_u_s argument to
--ll is a number specifying either a signal number or the exit
status of a process terminated by a signal. The --LL option is
equivalent to --ll. kkiillll returns true if at least one signal was
successfully sent, or false if an error occurs or an invalid op-
tion is encountered.
lleett _a_r_g [_a_r_g ...]
Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH--
MMEETTIICC EEVVAALLUUAATTIIOONN in _b_a_s_h_(_1_)). If the last _a_r_g evaluates to 0,
lleett returns 1; 0 is returned otherwise.
llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ... | - ]
For each argument, a local variable named _n_a_m_e is created, and
assigned _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted
by ddeeccllaarree. When llooccaall is used within a function, it causes the
variable _n_a_m_e to have a visible scope restricted to that func-
tion and its children. If _n_a_m_e is -, the set of shell options
is made local to the function in which llooccaall is invoked: shell
options changed using the sseett builtin inside the function are
restored to their original values when the function returns.
The restore is effected as if a series of sseett commands were exe-
cuted to restore the values that were in place before the func-
tion. With no operands, llooccaall writes a list of local variables
to the standard output. It is an error to use llooccaall when not
within a function. The return status is 0 unless llooccaall is used
outside a function, an invalid _n_a_m_e is supplied, or _n_a_m_e is a
readonly variable.
llooggoouutt Exit a login shell.
mmaappffiillee [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC
_c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
rreeaaddaarrrraayy [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC
_c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
Read lines from the standard input into the indexed array vari-
able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup-
plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
supplied, have the following meanings:
--dd The first character of _d_e_l_i_m is used to terminate each
input line, rather than newline. If _d_e_l_i_m is the empty
string, mmaappffiillee will terminate a line when it reads a NUL
character.
--nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
copied.
--OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
index is 0.
--ss Discard the first _c_o_u_n_t lines read.
--tt Remove a trailing _d_e_l_i_m (default newline) from each line
read.
--uu Read lines from file descriptor _f_d instead of the stan-
dard input.
--CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The
--cc option specifies _q_u_a_n_t_u_m.
--cc Specify the number of lines read between each call to
_c_a_l_l_b_a_c_k.
If --CC is specified without --cc, the default quantum is 5000.
When _c_a_l_l_b_a_c_k is evaluated, it is supplied the index of the next
array element to be assigned and the line to be assigned to that
element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after
the line is read but before the array element is assigned.
If not supplied with an explicit origin, mmaappffiillee will clear _a_r_-
_r_a_y before assigning to it.
mmaappffiillee returns successfully unless an invalid option or option
argument is supplied, _a_r_r_a_y is invalid or unassignable, or if
_a_r_r_a_y is not an indexed array.
ppooppdd [-nn] [+_n] [-_n]
Removes entries from the directory stack. The elements are num-
bered from 0 starting at the first directory listed by ddiirrss.
With no arguments, ppooppdd removes the top directory from the
stack, and changes to the new top directory. Arguments, if sup-
plied, have the following meanings:
--nn Suppresses the normal change of directory when removing
directories from the stack, so that only the stack is ma-
nipulated.
++_n Removes the _nth entry counting from the left of the list
shown by ddiirrss, starting with zero, from the stack. For
example: ``popd +0'' removes the first directory, ``popd
+1'' the second.
--_n Removes the _nth entry counting from the right of the list
shown by ddiirrss, starting with zero. For example: ``popd
-0'' removes the last directory, ``popd -1'' the next to
last.
If the top element of the directory stack is modified, and the
_-_n option was not supplied, ppooppdd uses the ccdd builtin to change
to the directory at the top of the stack. If the ccdd fails, ppooppdd
returns a non-zero value.
Otherwise, ppooppdd returns false if an invalid option is encoun-
tered, the directory stack is empty, or a non-existent directory
stack entry is specified.
If the ppooppdd command is successful, bash runs ddiirrss to show the
final contents of the directory stack, and the return status is
0.
pprriinnttff [--vv _v_a_r] _f_o_r_m_a_t [_a_r_g_u_m_e_n_t_s]
Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the
control of the _f_o_r_m_a_t. The --vv option causes the output to be
assigned to the variable _v_a_r rather than being printed to the
standard output.
The _f_o_r_m_a_t is a character string which contains three types of
objects: plain characters, which are simply copied to standard
output, character escape sequences, which are converted and
copied to the standard output, and format specifications, each
of which causes printing of the next successive _a_r_g_u_m_e_n_t. In
addition to the standard _p_r_i_n_t_f(1) format specifications, pprriinnttff
interprets the following extensions:
%%bb causes pprriinnttff to expand backslash escape sequences in the
corresponding _a_r_g_u_m_e_n_t in the same way as eecchhoo --ee.
%%qq causes pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a
format that can be reused as shell input.
%%QQ like %%qq, but applies any supplied precision to the _a_r_g_u_-
_m_e_n_t before quoting it.
%%((_d_a_t_e_f_m_t))TT
causes pprriinnttff to output the date-time string resulting
from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3).
The corresponding _a_r_g_u_m_e_n_t is an integer representing the
number of seconds since the epoch. Two special argument
values may be used: -1 represents the current time, and
-2 represents the time the shell was invoked. If no ar-
gument is specified, conversion behaves as if -1 had been
given. This is an exception to the usual pprriinnttff behav-
ior.
The %b, %q, and %T directives all use the field width and preci-
sion arguments from the format specification and write that many
bytes from (or use that wide a field for) the expanded argument,
which usually contains more characters than the original.
Arguments to non-string format specifiers are treated as C con-
stants, except that a leading plus or minus sign is allowed, and
if the leading character is a single or double quote, the value
is the ASCII value of the following character.
The _f_o_r_m_a_t is reused as necessary to consume all of the _a_r_g_u_-
_m_e_n_t_s. If the _f_o_r_m_a_t requires more _a_r_g_u_m_e_n_t_s than are supplied,
the extra format specifications behave as if a zero value or
null string, as appropriate, had been supplied. The return
value is zero on success, non-zero on failure.
ppuusshhdd [--nn] [+_n] [-_n]
ppuusshhdd [--nn] [_d_i_r]
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
directory. With no arguments, ppuusshhdd exchanges the top two ele-
ments of the directory stack. Arguments, if supplied, have the
following meanings:
--nn Suppresses the normal change of directory when rotating
or adding directories to the stack, so that only the
stack is manipulated.
++_n Rotates the stack so that the _nth directory (counting
from the left of the list shown by ddiirrss, starting with
zero) is at the top.
--_n Rotates the stack so that the _nth directory (counting
from the right of the list shown by ddiirrss, starting with
zero) is at the top.
_d_i_r Adds _d_i_r to the directory stack at the top
After the stack has been modified, if the --nn option was not sup-
plied, ppuusshhdd uses the ccdd builtin to change to the directory at
the top of the stack. If the ccdd fails, ppuusshhdd returns a non-zero
value.
Otherwise, if no arguments are supplied, ppuusshhdd returns 0 unless
the directory stack is empty. When rotating the directory
stack, ppuusshhdd returns 0 unless the directory stack is empty or a
non-existent directory stack element is specified.
If the ppuusshhdd command is successful, bash runs ddiirrss to show the
final contents of the directory stack.