Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/devmanual:master commit in: tools-reference/bash/
Date: Fri, 27 May 2022 09:02:55
Message-Id: 1653642095.3a69349de3d0c6ddc7eb27afd20f3416ece67ad1.ulm@gentoo
1 commit: 3a69349de3d0c6ddc7eb27afd20f3416ece67ad1
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 20 09:49:35 2022 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Fri May 27 09:01:35 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=3a69349d
7
8 tools-reference/bash: More compact table formatting in source code
9
10 No change of text.
11
12 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
13
14 tools-reference/bash/text.xml | 796 ++++++++++++++----------------------------
15 1 file changed, 270 insertions(+), 526 deletions(-)
16
17 diff --git a/tools-reference/bash/text.xml b/tools-reference/bash/text.xml
18 index ee1d7e3..0a7c33f 100644
19 --- a/tools-reference/bash/text.xml
20 +++ b/tools-reference/bash/text.xml
21 @@ -153,54 +153,30 @@ following are available:
22 </p>
23
24 <table>
25 - <tr>
26 - <th>
27 - Operator
28 - </th>
29 - <th>
30 - Purpose
31 - </th>
32 - </tr>
33 - <tr>
34 - <ti>
35 - <c>==</c> (also <c>=</c>)
36 - </ti>
37 - <ti>
38 - String equality
39 - </ti>
40 - </tr>
41 - <tr>
42 - <ti>
43 - <c>!=</c>
44 - </ti>
45 - <ti>
46 - String inequality
47 - </ti>
48 - </tr>
49 - <tr>
50 - <ti>
51 - <c>&lt;</c>
52 - </ti>
53 - <ti>
54 - String lexiographic comparison (before)
55 - </ti>
56 - </tr>
57 - <tr>
58 - <ti>
59 - <c>&gt;</c>
60 - </ti>
61 - <ti>
62 - String lexiographic comparison (after)
63 - </ti>
64 - </tr>
65 - <tr>
66 - <ti>
67 - <c>=~</c>
68 - </ti>
69 - <ti>
70 - String regular expression match
71 - </ti>
72 - </tr>
73 +<tr>
74 + <th>Operator</th>
75 + <th>Purpose</th>
76 +</tr>
77 +<tr>
78 + <ti><c>==</c> (also <c>=</c>)</ti>
79 + <ti>String equality</ti>
80 +</tr>
81 +<tr>
82 + <ti><c>!=</c></ti>
83 + <ti>String inequality</ti>
84 +</tr>
85 +<tr>
86 + <ti><c>&lt;</c></ti>
87 + <ti>String lexiographic comparison (before)</ti>
88 +</tr>
89 +<tr>
90 + <ti><c>&gt;</c></ti>
91 + <ti>String lexiographic comparison (after)</ti>
92 +</tr>
93 +<tr>
94 + <ti><c>=~</c></ti>
95 + <ti>String regular expression match</ti>
96 +</tr>
97 </table>
98
99 </body>
100 @@ -216,30 +192,18 @@ available:
101 </p>
102
103 <table>
104 - <tr>
105 - <th>
106 - Operator
107 - </th>
108 - <th>
109 - Purpose
110 - </th>
111 - </tr>
112 - <tr>
113 - <ti>
114 - <c>-z "string"</c>
115 - </ti>
116 - <ti>
117 - String has zero length
118 - </ti>
119 - </tr>
120 - <tr>
121 - <ti>
122 - <c>-n "string"</c>
123 - </ti>
124 - <ti>
125 - String has non-zero length
126 - </ti>
127 - </tr>
128 +<tr>
129 + <th>Operator</th>
130 + <th>Purpose</th>
131 +</tr>
132 +<tr>
133 + <ti><c>-z "string"</c></ti>
134 + <ti>String has zero length</ti>
135 +</tr>
136 +<tr>
137 + <ti><c>-n "string"</c></ti>
138 + <ti>String has non-zero length</ti>
139 +</tr>
140 </table>
141
142 </body>
143 @@ -255,62 +219,34 @@ following are available:
144 </p>
145
146 <table>
147 - <tr>
148 - <th>
149 - Operator
150 - </th>
151 - <th>
152 - Purpose
153 - </th>
154 - </tr>
155 - <tr>
156 - <ti>
157 - <c>-eq</c>
158 - </ti>
159 - <ti>
160 - Integer equality
161 - </ti>
162 - </tr>
163 - <tr>
164 - <ti>
165 - <c>-ne</c>
166 - </ti>
167 - <ti>
168 - Integer inequality
169 - </ti>
170 - </tr>
171 - <tr>
172 - <ti>
173 - <c>-lt</c>
174 - </ti>
175 - <ti>
176 - Integer less than
177 - </ti>
178 - </tr>
179 - <tr>
180 - <ti>
181 - <c>-le</c>
182 - </ti>
183 - <ti>
184 - Integer less than or equal to
185 - </ti>
186 - </tr>
187 - <tr>
188 - <ti>
189 - <c>-gt</c>
190 - </ti>
191 - <ti>
192 - Integer greater than
193 - </ti>
194 - </tr>
195 - <tr>
196 - <ti>
197 - <c>-ge</c>
198 - </ti>
199 - <ti>
200 - Integer greater than or equal to
201 - </ti>
202 - </tr>
203 +<tr>
204 + <th>Operator</th>
205 + <th>Purpose</th>
206 +</tr>
207 +<tr>
208 + <ti><c>-eq</c></ti>
209 + <ti>Integer equality</ti>
210 +</tr>
211 +<tr>
212 + <ti><c>-ne</c></ti>
213 + <ti>Integer inequality</ti>
214 +</tr>
215 +<tr>
216 + <ti><c>-lt</c></ti>
217 + <ti>Integer less than</ti>
218 +</tr>
219 +<tr>
220 + <ti><c>-le</c></ti>
221 + <ti>Integer less than or equal to</ti>
222 +</tr>
223 +<tr>
224 + <ti><c>-gt</c></ti>
225 + <ti>Integer greater than</ti>
226 +</tr>
227 +<tr>
228 + <ti><c>-ge</c></ti>
229 + <ti>Integer greater than or equal to</ti>
230 +</tr>
231 </table>
232
233 </body>
234 @@ -326,182 +262,94 @@ available (lifted from <c>man bash</c>):
235 </p>
236
237 <table>
238 - <tr>
239 - <th>
240 - Operator
241 - </th>
242 - <th>
243 - Purpose
244 - </th>
245 - </tr>
246 - <tr>
247 - <ti>
248 - <c>-a file</c>
249 - </ti>
250 - <ti>
251 - Exists (use <c>-e</c> instead)
252 - </ti>
253 - </tr>
254 - <tr>
255 - <ti>
256 - <c>-b file</c>
257 - </ti>
258 - <ti>
259 - Exists and is a block special file
260 - </ti>
261 - </tr>
262 - <tr>
263 - <ti>
264 - <c>-c file</c>
265 - </ti>
266 - <ti>
267 - Exists and is a character special file
268 - </ti>
269 - </tr>
270 - <tr>
271 - <ti>
272 - <c>-d file</c>
273 - </ti>
274 - <ti>
275 - Exists and is a directory
276 - </ti>
277 - </tr>
278 - <tr>
279 - <ti>
280 - <c>-e file</c>
281 - </ti>
282 - <ti>
283 - Exists
284 - </ti>
285 - </tr>
286 - <tr>
287 - <ti>
288 - <c>-f file</c>
289 - </ti>
290 - <ti>
291 - Exists and is a regular file
292 - </ti>
293 - </tr>
294 - <tr>
295 - <ti>
296 - <c>-g file</c>
297 - </ti>
298 - <ti>
299 - Exists and is set-group-id
300 - </ti>
301 - </tr>
302 - <tr>
303 - <ti>
304 - <c>-h file</c>
305 - </ti>
306 - <ti>
307 - Exists and is a symbolic link
308 - </ti>
309 - </tr>
310 - <tr>
311 - <ti>
312 - <c>-k file</c>
313 - </ti>
314 - <ti>
315 - Exists and its sticky bit is set
316 - </ti>
317 - </tr>
318 - <tr>
319 - <ti>
320 - <c>-p file</c>
321 - </ti>
322 - <ti>
323 - Exists and is a named pipe (FIFO)
324 - </ti>
325 - </tr>
326 - <tr>
327 - <ti>
328 - <c>-r file</c>
329 - </ti>
330 - <ti>
331 - Exists and is readable
332 - </ti>
333 - </tr>
334 - <tr>
335 - <ti>
336 - <c>-s file</c>
337 - </ti>
338 - <ti>
339 - Exists and has a size greater than zero
340 - </ti>
341 - </tr>
342 - <tr>
343 - <ti>
344 - <c>-t fd</c>
345 - </ti>
346 - <ti>
347 - Descriptor fd is open and refers to a terminal
348 - </ti>
349 - </tr>
350 - <tr>
351 - <ti>
352 - <c>-u file</c>
353 - </ti>
354 - <ti>
355 - Exists and its set-user-id bit is set
356 - </ti>
357 - </tr>
358 - <tr>
359 - <ti>
360 - <c>-w file</c>
361 - </ti>
362 - <ti>
363 - Exists and is writable
364 - </ti>
365 - </tr>
366 - <tr>
367 - <ti>
368 - <c>-x file</c>
369 - </ti>
370 - <ti>
371 - Exists and is executable
372 - </ti>
373 - </tr>
374 - <tr>
375 - <ti>
376 - <c>-O file</c>
377 - </ti>
378 - <ti>
379 - Exists and is owned by the effective user id
380 - </ti>
381 - </tr>
382 - <tr>
383 - <ti>
384 - <c>-G file</c>
385 - </ti>
386 - <ti>
387 - Exists and is owned by the effective group id
388 - </ti>
389 - </tr>
390 - <tr>
391 - <ti>
392 - <c>-L file</c>
393 - </ti>
394 - <ti>
395 - Exists and is a symbolic link
396 - </ti>
397 - </tr>
398 - <tr>
399 - <ti>
400 - <c>-S file</c>
401 - </ti>
402 - <ti>
403 - Exists and is a socket
404 - </ti>
405 - </tr>
406 - <tr>
407 - <ti>
408 - <c>-N file</c>
409 - </ti>
410 - <ti>
411 - Exists and has been modified since it was last read
412 - </ti>
413 - </tr>
414 +<tr>
415 + <th>Operator</th>
416 + <th>Purpose</th>
417 +</tr>
418 +<tr>
419 + <ti><c>-a file</c></ti>
420 + <ti>Exists (use <c>-e</c> instead)</ti>
421 +</tr>
422 +<tr>
423 + <ti><c>-b file</c></ti>
424 + <ti>Exists and is a block special file</ti>
425 +</tr>
426 +<tr>
427 + <ti><c>-c file</c></ti>
428 + <ti>Exists and is a character special file</ti>
429 +</tr>
430 +<tr>
431 + <ti><c>-d file</c></ti>
432 + <ti>Exists and is a directory</ti>
433 +</tr>
434 +<tr>
435 + <ti><c>-e file</c></ti>
436 + <ti>Exists</ti>
437 +</tr>
438 +<tr>
439 + <ti><c>-f file</c></ti>
440 + <ti>Exists and is a regular file</ti>
441 +</tr>
442 +<tr>
443 + <ti><c>-g file</c></ti>
444 + <ti>Exists and is set-group-id</ti>
445 +</tr>
446 +<tr>
447 + <ti><c>-h file</c></ti>
448 + <ti>Exists and is a symbolic link</ti>
449 +</tr>
450 +<tr>
451 + <ti><c>-k file</c></ti>
452 + <ti>Exists and its sticky bit is set</ti>
453 +</tr>
454 +<tr>
455 + <ti><c>-p file</c></ti>
456 + <ti>Exists and is a named pipe (FIFO)</ti>
457 +</tr>
458 +<tr>
459 + <ti><c>-r file</c></ti>
460 + <ti>Exists and is readable</ti>
461 +</tr>
462 +<tr>
463 + <ti><c>-s file</c></ti>
464 + <ti>Exists and has a size greater than zero</ti>
465 +</tr>
466 +<tr>
467 + <ti><c>-t fd</c></ti>
468 + <ti>Descriptor fd is open and refers to a terminal</ti>
469 +</tr>
470 +<tr>
471 + <ti><c>-u file</c></ti>
472 + <ti>Exists and its set-user-id bit is set</ti>
473 +</tr>
474 +<tr>
475 + <ti><c>-w file</c></ti>
476 + <ti>Exists and is writable</ti>
477 +</tr>
478 +<tr>
479 + <ti><c>-x file</c></ti>
480 + <ti>Exists and is executable</ti>
481 +</tr>
482 +<tr>
483 + <ti><c>-O file</c></ti>
484 + <ti>Exists and is owned by the effective user id</ti>
485 +</tr>
486 +<tr>
487 + <ti><c>-G file</c></ti>
488 + <ti>Exists and is owned by the effective group id</ti>
489 +</tr>
490 +<tr>
491 + <ti><c>-L file</c></ti>
492 + <ti>Exists and is a symbolic link</ti>
493 +</tr>
494 +<tr>
495 + <ti><c>-S file</c></ti>
496 + <ti>Exists and is a socket</ti>
497 +</tr>
498 +<tr>
499 + <ti><c>-N file</c></ti>
500 + <ti>Exists and has been modified since it was last read</ti>
501 +</tr>
502 </table>
503
504 </body>
505 @@ -517,41 +365,25 @@ following are available (lifted from <c>man bash</c>):
506 </p>
507
508 <table>
509 - <tr>
510 - <th>
511 - Operator
512 - </th>
513 - <th>
514 - Purpose
515 - </th>
516 - </tr>
517 - <tr>
518 - <ti>
519 - <c>file1 -nt file2</c>
520 - </ti>
521 - <ti>
522 - file1 is newer (according to modification date) than
523 - file2, or if file1 exists and file2 does not.
524 - </ti>
525 - </tr>
526 - <tr>
527 - <ti>
528 - <c>file1 -ot file2</c>
529 - </ti>
530 - <ti>
531 - file1 is older than file2, or if file2 exists and
532 - file1 does not.
533 - </ti>
534 - </tr>
535 - <tr>
536 - <ti>
537 - <c>file1 -ef file2</c>
538 - </ti>
539 - <ti>
540 - file1 and file2 refer to the same device and inode
541 - numbers.
542 - </ti>
543 - </tr>
544 +<tr>
545 + <th>Operator</th>
546 + <th>Purpose</th>
547 +</tr>
548 +<tr>
549 + <ti><c>file1 -nt file2</c></ti>
550 + <ti>
551 + file1 is newer (according to modification date) than file2,
552 + or if file1 exists and file2 does not.
553 + </ti>
554 +</tr>
555 +<tr>
556 + <ti><c>file1 -ot file2</c></ti>
557 + <ti>file1 is older than file2, or if file2 exists and file1 does not.</ti>
558 +</tr>
559 +<tr>
560 + <ti><c>file1 -ef file2</c></ti>
561 + <ti>file1 and file2 refer to the same device and inode numbers.</ti>
562 +</tr>
563 </table>
564
565 </body>
566 @@ -568,39 +400,23 @@ These are used <e>outside</e> of the <c>[[ ]]</c> blocks. For operator precedenc
567 </p>
568
569 <table>
570 - <tr>
571 - <th>
572 - Construct
573 - </th>
574 - <th>
575 - Effect
576 - </th>
577 - </tr>
578 - <tr>
579 - <ti>
580 - <c>first || second</c>
581 - </ti>
582 - <ti>
583 - first <e>or</e> second (short circuit)
584 - </ti>
585 - </tr>
586 - <tr>
587 - <ti>
588 - <c>
589 - first &amp;&amp; second</c>
590 - </ti>
591 - <ti>
592 - first <e>and</e> second (short circuit)
593 - </ti>
594 - </tr>
595 - <tr>
596 - <ti>
597 - <c>! condition</c>
598 - </ti>
599 - <ti>
600 - <e>not</e> condition
601 - </ti>
602 - </tr>
603 +<tr>
604 + <th>Construct</th>
605 + <th>Effect</th>
606 +</tr>
607 +<tr>
608 + <ti><c>first || second</c></ti>
609 + <ti>first <e>or</e> second (short circuit)</ti>
610 +</tr>
611 +<tr>
612 + <ti><c>
613 +first &amp;&amp; second</c></ti>
614 + <ti>first <e>and</e> second (short circuit)</ti>
615 +</tr>
616 +<tr>
617 + <ti><c>! condition</c></ti>
618 + <ti><e>not</e> condition</ti>
619 +</tr>
620 </table>
621
622
623 @@ -878,160 +694,88 @@ operators are supported (the table is in order of precedence, highest first):
624 </p>
625
626 <table>
627 - <tr>
628 - <th>
629 - Operators
630 - </th>
631 - <th>
632 - Effect
633 - </th>
634 - </tr>
635 - <tr>
636 - <ti>
637 - <c>var++</c>, <c>var--</c>
638 - </ti>
639 - <ti>
640 - Variable post-increment, post-decrement
641 - </ti>
642 - </tr>
643 - <tr>
644 - <ti>
645 - <c>++var</c>, <c>--var</c>
646 - </ti>
647 - <ti>
648 - Variable pre-increment, pre-decrement
649 - </ti>
650 - </tr>
651 - <tr>
652 - <ti>
653 - <c>-</c>, <c>+</c>
654 - </ti>
655 - <ti>
656 - Unary minus and plus
657 - </ti>
658 - </tr>
659 - <tr>
660 - <ti>
661 - <c>!</c>, <c>~</c>
662 - </ti>
663 - <ti>
664 - Logical negation, bitwise negation
665 - </ti>
666 - </tr>
667 - <tr>
668 - <ti>
669 - <c>**</c>
670 - </ti>
671 - <ti>
672 - Exponentiation
673 - </ti>
674 - </tr>
675 - <tr>
676 - <ti>
677 - <c>*</c>, <c>/</c>, <c>%</c>
678 - </ti>
679 - <ti>
680 - Multiplication, division, remainder
681 - </ti>
682 - </tr>
683 - <tr>
684 - <ti>
685 - <c>+</c>, <c>-</c>
686 - </ti>
687 - <ti>
688 - Addition, subtraction
689 - </ti>
690 - </tr>
691 - <tr>
692 - <ti>
693 - <c>&lt;&lt;</c>, <c>&gt;&gt;</c>
694 - </ti>
695 - <ti>
696 - Left, right bitwise shifts
697 - </ti>
698 - </tr>
699 - <tr>
700 - <ti>
701 - <c>&lt;=</c>, <c>&gt;=</c>, <c>&lt;</c>, <c>&gt;</c>
702 - </ti>
703 - <ti>
704 - Comparison: less than or equal to, greater than or
705 - equal to, strictly less than, strictly greater than
706 - </ti>
707 - </tr>
708 - <tr>
709 - <ti>
710 - <c>==</c>, <c>!=</c>
711 - </ti>
712 - <ti>
713 - Equality, inequality
714 - </ti>
715 - </tr>
716 - <tr>
717 - <ti>
718 - <c>&amp;</c>
719 - </ti>
720 - <ti>
721 - Bitwise AND
722 - </ti>
723 - </tr>
724 - <tr>
725 - <ti>
726 - <c>^</c>
727 - </ti>
728 - <ti>
729 - Bitwise exclusive OR
730 - </ti>
731 - </tr>
732 - <tr>
733 - <ti>
734 - <c>|</c>
735 - </ti>
736 - <ti>
737 - Bitwise OR
738 - </ti>
739 - </tr>
740 - <tr>
741 - <ti>
742 - <c>&amp;&amp;</c>
743 - </ti>
744 - <ti>
745 - Logical AND
746 - </ti>
747 - </tr>
748 - <tr>
749 - <ti>
750 - <c>||</c>
751 - </ti>
752 - <ti>
753 - Logical OR
754 - </ti>
755 - </tr>
756 - <tr>
757 - <ti>
758 - <c>expr ? expr : expr</c>
759 - </ti>
760 - <ti>
761 - Conditional operator
762 - </ti>
763 - </tr>
764 - <tr>
765 - <ti>
766 - <c>=</c>, <c>*=</c>, <c>/=</c>, <c>%=</c>, <c>+=</c>, <c>-=</c>, <c>&lt;&lt;=</c>,
767 - <c>&gt;&gt;=</c>, <c>&amp;=</c>, <c>^=</c>, <c>|=</c>
768 - </ti>
769 - <ti>
770 - Assignment
771 - </ti>
772 - </tr>
773 - <tr>
774 - <ti>
775 - <c>expr1 , expr2</c>
776 - </ti>
777 - <ti>
778 - Multiple statements
779 - </ti>
780 - </tr>
781 +<tr>
782 + <th>Operators</th>
783 + <th>Effect</th>
784 +</tr>
785 +<tr>
786 + <ti><c>var++</c>, <c>var--</c></ti>
787 + <ti>Variable post-increment, post-decrement</ti>
788 +</tr>
789 +<tr>
790 + <ti><c>++var</c>, <c>--var</c></ti>
791 + <ti>Variable pre-increment, pre-decrement</ti>
792 +</tr>
793 +<tr>
794 + <ti><c>-</c>, <c>+</c></ti>
795 + <ti>Unary minus and plus</ti>
796 +</tr>
797 +<tr>
798 + <ti><c>!</c>, <c>~</c></ti>
799 + <ti>Logical negation, bitwise negation</ti>
800 +</tr>
801 +<tr>
802 + <ti><c>**</c></ti>
803 + <ti>Exponentiation</ti>
804 +</tr>
805 +<tr>
806 + <ti><c>*</c>, <c>/</c>, <c>%</c></ti>
807 + <ti>Multiplication, division, remainder</ti>
808 +</tr>
809 +<tr>
810 + <ti><c>+</c>, <c>-</c></ti>
811 + <ti>Addition, subtraction</ti>
812 +</tr>
813 +<tr>
814 + <ti><c>&lt;&lt;</c>, <c>&gt;&gt;</c></ti>
815 + <ti>Left, right bitwise shifts</ti>
816 +</tr>
817 +<tr>
818 + <ti><c>&lt;=</c>, <c>&gt;=</c>, <c>&lt;</c>, <c>&gt;</c></ti>
819 + <ti>
820 + Comparison: less than or equal to, greater than or equal to,
821 + strictly less than, strictly greater than
822 + </ti>
823 +</tr>
824 +<tr>
825 + <ti><c>==</c>, <c>!=</c></ti>
826 + <ti>Equality, inequality</ti>
827 +</tr>
828 +<tr>
829 + <ti><c>&amp;</c></ti>
830 + <ti>Bitwise AND</ti>
831 +</tr>
832 +<tr>
833 + <ti><c>^</c></ti>
834 + <ti>Bitwise exclusive OR</ti>
835 +</tr>
836 +<tr>
837 + <ti><c>|</c></ti>
838 + <ti>Bitwise OR</ti>
839 +</tr>
840 +<tr>
841 + <ti><c>&amp;&amp;</c></ti>
842 + <ti>Logical AND</ti>
843 +</tr>
844 +<tr>
845 + <ti><c>||</c></ti>
846 + <ti>Logical OR</ti>
847 +</tr>
848 +<tr>
849 + <ti><c>expr ? expr : expr</c></ti>
850 + <ti>Conditional operator</ti>
851 +</tr>
852 +<tr>
853 + <ti>
854 + <c>=</c>, <c>*=</c>, <c>/=</c>, <c>%=</c>, <c>+=</c>, <c>-=</c>,
855 + <c>&lt;&lt;=</c>, <c>&gt;&gt;=</c>, <c>&amp;=</c>, <c>^=</c>, <c>|=</c>
856 + </ti>
857 + <ti>Assignment</ti>
858 +</tr>
859 +<tr>
860 + <ti><c>expr1 , expr2</c></ti>
861 + <ti>Multiple statements</ti>
862 +</tr>
863 </table>
864
865 <note>