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
package Torello.Java;

import java.io.*;
import java.util.*;
import java.util.regex.*;

import java.util.concurrent.CompletionException;
import java.util.function.Consumer;

import Torello.Java.*;
import Torello.HTML.*;
import Torello.HTML.NodeSearch.*;
import Torello.Java.Additional.*;

/**
 * A great tool for working with a UNIX operating-system, and invoking common UNIX commands - this
 * class simply converts many of the old UNIX-BASH shell commands into a simple Java API.
 * 
 * <EMBED CLASS='external-html' DATA-FILE-ID=SHELL>
 * <EMBED ClASS='external-html' DATA-FILE-ID=OSC_WORA>
 * <EMBED CLASS='external-html' DATA-FILE-ID=OSC_WILD_CARD_02>
 * <EMBED CLASS='external-html' DATA-CLASS=Shell DATA-VAR=shell DATA-FILE-ID=OSC_ALL_FIELDS>
 * <EMBED CLASS='external-html' DATA-FILE-ID=APPENDABLE>
 * 
 * @see OSCommands
 * @see OSResponse
 */
@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="OSC_INHERITORS")
public class Shell extends OSCommands implements Cloneable
{
    // ********************************************************************************************
    // ********************************************************************************************
    // Constructors
    // ********************************************************************************************
    // ********************************************************************************************


    /** <EMBED CLASS='external-html' DATA-FILE-ID=OSC_CTOR_1> */
    public Shell() { super(); }

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=OSC_CTOR_2>
     * @param outputAppendable <EMBED CLASS='external-html' DATA-FILE-ID=OSC_APPENDABLE_PARAM>
     * @see OSCommands#outputAppendable
     */
    public Shell(Appendable outputAppendable)
    { super(outputAppendable); }

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=OSC_CTOR_3>
     * 
     * @param outputAppendable      <EMBED CLASS='external-html' DATA-FILE-ID=OSC_APPENDABLE_PARAM>
     * @param commandStrAppendable  <EMBED CLASS='external-html' DATA-FILE-ID=OSC_CSA_PARAM>
     * @param standardOutput        <EMBED CLASS='external-html' DATA-FILE-ID=OSC_STND_OUT_PARAM>
     * @param errorOutput           <EMBED CLASS='external-html' DATA-FILE-ID=OSC_ERROR_OUT_PARAM>
     * @see OSCommands#outputAppendable
     * @see OSCommands#commandStrAppendable
     * @see OSCommands#standardOutput 
     * @see OSCommands#errorOutput 
     */
    public Shell(
            Appendable outputAppendable,
            Appendable commandStrAppendable,
            Appendable standardOutput,
            Appendable errorOutput
        )
    { super(outputAppendable, commandStrAppendable, standardOutput, errorOutput); }

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=OSC_CTOR_4>
     * 
     * @param standardOutput    <EMBED CLASS='external-html' DATA-FILE-ID=OSC_STND_OUT_PARAM>
     * @param errorOutput       <EMBED CLASS='external-html' DATA-FILE-ID=OSC_ERROR_OUT_PARAM>
     * @see OSCommands#standardOutput 
     * @see OSCommands#errorOutput 
     */
    public Shell(Appendable standardOutput, Appendable errorOutput)
    { super(standardOutput, errorOutput); }

    /**
     * Used by the method {@code clone()}.
     * @param other Another instance of this class.
     */
    protected Shell(Shell other) { super(other); }

    /** {@inheritDoc} */
    public Shell clone() { return new Shell(this); }



    // ********************************************************************************************
    // ********************************************************************************************
    // The Methods
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * UNIX Shell Command: {@code Copy}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ cp <src> <target>
     * }</DIV>
     * 
     * @param src UNIX/Linux/BASH-Shell {@code 'cp'} command's "source" argument
     * @param target The {@code 'cp'} command "target" argument
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CP(String src, String target) throws IOException
    { 
        String[] command = { "cp", src, target };

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Copy}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ cp <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)> <target>
     * }</DIV>
     * 
     * @param src This may be a list of files to be copied to a target directory
     * @param target This is the target directory for the files listed.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CP(Vector<String> src, String target) throws IOException
    {
        String[] command = new String[src.size() + 2];
        command[0] = "cp";
        command[src.size() + 1] = target;

        for (int i=0; i < src.size(); i++) command[1 + i] = src.elementAt(i);

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Copy}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ cp <src[0]> <src[1]> ... <src[src.length-1]> <target>
     * }</DIV>
     * 
     * @param src This may be a list of files to be copied to a target directory
     * @param target This is the target directory for the files listed.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CP(String[] src, String target) throws IOException
    {
        String[] command = new String[src.length + 2];
        command[0] = "cp";
        command[src.length + 1] = target;

        for (int i=0; i < src.length; i++) command[1 + i] = src[i];

        return printAndRun(command);
    }	

    /**
     * UNIX Shell Command: {@code List}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ ls <fileOrDir>
     * }</DIV>
     * 
     * @param fileOrDir This is the file <B><I>OR</I></B> directory to be searched.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse LS(String fileOrDir) throws IOException
    { 
        String[] command = { "ls", fileOrDir };

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code List}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ ls <switches> <fileOrDir>
     * }</DIV>
     * 
     * @param fileOrDir This is the file <B><I>OR</I></B> directory to be searched.
     * @param switches These are switches that are added to the command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse LS(String fileOrDir, String switches)
        throws IOException
    { 
        String[] command = { "ls", switches, fileOrDir };

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Move}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ mv <src> <target>
     * }</DIV>
     * 
     * @param src The first {@code String} in a typical UNIX {@code 'move'} command. It is the
     * "source file"
     * 
     * @param target The second {@code String} for a "move."  This is the destination or target.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse MV(String src, String target) throws IOException
    { 
        String[] command = { "mv", src, target };

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Move}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ mv <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)> <target>
     * }</DIV>
     * 
     * @param src The first {@code String} in a typical UNIX {@code 'move'} command.
     * It is the "source file" - In this method, it is a list of files and expressions saved as a
     * {@code Vector}.
     * 
     * @param target The second {@code String} for a {@code 'move'} UNIX command, and it is the
     * target destination of the source-file.
     * 
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse MV(Vector<String> src, String target) throws IOException
    {
        String[] command = new String[src.size() + 2];
        command[0] = "mv";
        command[src.size() + 1] = target;

        for (int i=0; i < src.size(); i++) command[1 + i] = src.elementAt(i);

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Move}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ mv <src[0]> <src[1]> ... <src[src.length-1]> <target>
     * }</DIV>
     * 
     * @param src The first {@code String} in a typical UNIX {@code 'move'} command.
     * It is the "source file" - In this method, it is a list of files and expressions saved as an
     * array.
     * 
     * @param target The second {@code String} for a UNIX {@code 'move'} command, and it is the
     * target destination
     * 
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse MV(String[] src, String target) throws IOException
    {
        String[] command = new String[src.length + 2];
        command[0] = "mv";
        command[src.length + 1] = target;

        for (int i=0; i < src.length; i++) command[1 + i] = src[i];

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Remove}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ rm <s1>
     * }</DIV>
     * 
     * @param s1 The item to be removed, using a UNIX operating-system command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse RM(String s1) throws IOException
    { 
        String[] command = { "rm", s1 };

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Remove}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ rm <sArr[0]> <sArr[1]> ... <sArr[sArr.length-1]>
     * }</DIV>
     * 
     * @param sArr An {@code String[] array} which is added to the end of this UNIX command.
     * These will be the item(s) removed by the UNIX {@code 'RM'} command.
     * 
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse RM(String[] sArr) throws IOException
    {
        String[] command = new String[sArr.length + 1];
        command[0] = "rm";

        for (int i=0; i < sArr.length; i++) command[i + 1] = sArr[i];

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Remove}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ rm  <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)>
     * }</DIV>
     * 
     * @param v A {@code Vector<String>} that contains command-line-parameters which
     * are added, sequentially, to the end of this UNIX command.  The {@code String's} in
     * this {@code Vector} are the item(s) to be removed by the UNIX {@code 'RM'} command.
     * 
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse RM(Vector<String> v) throws IOException
    {
        String[] command = new String[v.size() + 1];
        command[0] = "rm";

        for (int i=0; i < v.size(); i++) command[i + 1] = v.elementAt(i);

        return printAndRun(command);
    }

    /**
     * UNIX Shell Command: {@code Remove}
     * 
     * <DIV CLASS="SHELL">{@code
     * $ rm <switches> <s1>
     * }</DIV>
     * 
     * @param s1 A file or directory parameter passed to {@code 'RM'}
     * @param switches These are switches (for-instance: {@code -R}, recursive).
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse RM(String s1, String switches) throws IOException
    { 
        String[] command = { "rm", switches, s1 };

        return printAndRun(command);
    }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code tar}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ tar <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse TAR(String... args) throws IOException
    { return ARGS_PLUS_ONE("tar", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code jar}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ jar <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse JAR(String... args) throws IOException
    { return ARGS_PLUS_ONE("jar", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code grep}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ grep <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse GREP(String... args) throws IOException
    { return ARGS_PLUS_ONE("grep", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code find}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ find <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse FIND(String... args) throws IOException
    { return ARGS_PLUS_ONE("find", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code du}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ du <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse DU(String... args) throws IOException
    { return ARGS_PLUS_ONE("du", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code df}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ df <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse DF(String... args) throws IOException
    { return ARGS_PLUS_ONE("df", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code sed}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ sed <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse SED(String... args) throws IOException
    { return ARGS_PLUS_ONE("sed", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code whatis}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ whatis <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse WHATIS(String... args) throws IOException
    { return ARGS_PLUS_ONE("whatis", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code whereis}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ whereis <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse WHEREIS(String... args) throws IOException
    { return ARGS_PLUS_ONE("whereis", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code vmstat}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ vmstat <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse VMSTAT(String... args) throws IOException
    { return ARGS_PLUS_ONE("vmstat", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code ps}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ ps <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse PS(String... args) throws IOException
    { return ARGS_PLUS_ONE("ps", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code diff}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ diff <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse DIFF(String... args) throws IOException
    { return ARGS_PLUS_ONE("diff", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code cmp}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ cmp <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CMP(String... args) throws IOException
    { return ARGS_PLUS_ONE("CMP", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code free}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ free <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse FREE(String... args) throws IOException
    { return ARGS_PLUS_ONE("free", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code chown}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ chown <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CHOWN(String... args) throws IOException
    { return ARGS_PLUS_ONE("chown", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code chmod}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ chmod <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse CHMOD(String... args) throws IOException
    { return ARGS_PLUS_ONE("chmod", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code unzip}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ unzip <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse UNZIP(String... args) throws IOException
    { return ARGS_PLUS_ONE("unzip", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code gzip}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ gzip <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse GZIP(String... args) throws IOException
    { return ARGS_PLUS_ONE("gzip", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code sort}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ sort <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse SORT(String... args) throws IOException
    { return ARGS_PLUS_ONE("sort", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code javac}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ javac <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse JAVAC(String... args) throws IOException
    { return ARGS_PLUS_ONE("javac", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code javadoc}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ javadoc <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse JAVADOC(String... args) throws IOException
    { return ARGS_PLUS_ONE("javadoc", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code java}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ java <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse JAVA(String... args) throws IOException
    { return ARGS_PLUS_ONE("java", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code time}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ time <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse TIME(String... args) throws IOException
    { return ARGS_PLUS_ONE("java", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code date}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ date <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public  OSResponse DATE(String... args) throws IOException
    { return ARGS_PLUS_ONE("java", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code traceroute}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ traceroute <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse TRACEROUTE(String... args) throws IOException
    { return ARGS_PLUS_ONE("traceroute", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code fsck}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ fsck <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse FSCK(String... args) throws IOException
    { return ARGS_PLUS_ONE("fsck", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code nslookup}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ nslookup <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse NSLOOKUP(String... args) throws IOException
    { return ARGS_PLUS_ONE("nslookup", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command: <B>{@code ping}</B>
     *
     * <DIV CLASS="SHELL">{@code
     * $ ping <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse PING(String... args) throws IOException
    { return ARGS_PLUS_ONE("ping", args); }

    /**
     * Runs the {@code UNIX / BASH / LINUX 'shell'} command named by the input parameter
     * {@code COMMAND_NAME}.
     *
     * <DIV CLASS="SHELL">{@code
     * $ COMMAND_NAME <args[0]> <args[1]> ... <args[args.length-1]>
     * }</DIV>
     * 
     * <EMBED CLASS='external-html' DATA-FILE-ID=SH_COMMAND>
     *
     * @param COMMAND_NAME This is the name of any UNIX command not already listed inside this
     * class.
     * 
     * @param args Any set of switches and/or arguments to this BASH command.
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @throws IOException If there are problems while invoking the operating-system command
     */
    public OSResponse COMMAND(String COMMAND_NAME, String... args) throws IOException
    { return ARGS_PLUS_ONE(COMMAND_NAME, args); }

    /**
     * This just appends the UNIX/BASH Shell command to the beginning of the {@code String[]}
     * (String...) of arguments, and then calls the execution of the comamnd.
     * 
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=OSRET>
     * @see OSCommands#printAndRun(String[])
     * @throws IOException If there are problems while invoking the operating-system command
     */
    private OSResponse ARGS_PLUS_ONE(String command, String... args)
        throws IOException 
    {
        String[] argsPlus1 = new String[args.length + 1];
        argsPlus1[0] = command;

        for (int i=0; i < args.length; i++) argsPlus1[1 + i] = args[i];

        return printAndRun(argsPlus1);
    }
}