summaryrefslogtreecommitdiffstats
path: root/shell/general_commands.rst
blob: c74ae454b44005fc88b6cd600bb0848276d66c4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
.. SPDX-License-Identifier: CC-BY-SA-4.0

.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)

General Commands
****************

Introduction
============

The RTEMS shell has the following general commands:

- help_ - Print command help

- alias_ - Add alias for an existing command

- cmdls_ - List commands

- cmdchown_ - Change user or owner of commands

- cmdchmod_ - Change mode of commands

- date_ - Print or set current date and time

- echo_ - Produce message in a shell script

- sleep_ - Delay for a specified amount of time

- id_ - show uid gid euid and egid

- tty_ - show ttyname

- whoami_ - print effective user id

- getenv_ - print environment variable

- setenv_ - set environment variable

- unsetenv_ - unset environment variable

- time_ - time command execution

- logoff_ - logoff from the system

- rtc_ - RTC driver configuration

- exit_ - alias for logoff command

Commands
========

This section details the General Commands available.  A subsection is dedicated
to each of the commands and describes the behavior and configuration of that
command as well as providing an example usage.

.. raw:: latex

   \clearpage

.. _help:

help - Print command help
-------------------------
.. index:: help

SYNOPSYS:
    .. code-block:: shell

        help misc

DESCRIPTION:
    This command prints the command help. Help without arguments prints a list
    of topics and help with a topic prints the help for that topic.

EXIT STATUS:
    This command returns 0.

NOTES:
    The help print will break the output up based on the environment variable
    SHELL_LINES. If this environment variable is not set the default is 16
    lines. If set the number of lines is set to that the value. If the shell
    lines is set 0 there will be no break.

EXAMPLES:
    The following is an example of how to use ``alias``:

    .. code-block:: shell

        SHLL [/] $ help
        help: ('r' repeat last cmd - 'e' edit last cmd)
        TOPIC? The topics are
        mem, misc, files, help, rtems, network, monitor
        SHLL [/] $ help misc
        help: list for the topic 'misc'
        alias        - alias old new
        time         - time command [arguments...]
        joel         - joel [args] SCRIPT
        date         - date [YYYY-MM-DD HH:MM:SS]
        echo         - echo [args]
        sleep        - sleep seconds [nanoseconds]
        id           - show uid, gid, euid, and egid
        tty          - show ttyname
        whoami       - show current user
        logoff       - logoff from the system
        setenv       - setenv [var] [string]
        getenv       - getenv [var]
        unsetenv     - unsetenv [var]
        umask        - umask [new_umask]
        Press any key to continue...
        rtc          - real time clock read and set
        SHLL [/] $ setenv SHELL_ENV 0
        SHLL [/] $ help misc
        help: list for the topic 'misc'
        alias        - alias old new
        time         - time command [arguments...]
        joel         - joel [args] SCRIPT
        date         - date [YYYY-MM-DD HH:MM:SS]
        echo         - echo [args]
        sleep        - sleep seconds [nanoseconds]
        id           - show uid, gid, euid, and egid
        tty          - show ttyname
        whoami       - show current user
        logoff       - logoff from the system
        setenv       - setenv [var] [string]
        getenv       - getenv [var]
        unsetenv     - unsetenv [var]
        umask        - umask [new_umask]
        rtc          - real time clock read and set

CONFIGURATION:
    This command has no configuration.

.. raw:: latex

   \clearpage

.. _alias:

alias - add alias for an existing command
-----------------------------------------
.. index:: alias

SYNOPSYS:
    .. code-block:: shell

        alias oldCommand newCommand

DESCRIPTION:
    This command adds an alternate name for an existing command to the command
    set.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``alias``:

    .. code-block:: shell

        SHLL [/] $ me
        shell:me command not found
        SHLL [/] $ alias whoami me
        SHLL [/] $ me
        rtems
        SHLL [/] $ whoami
        rtems

.. index:: CONFIGURE_SHELL_NO_COMMAND_ALIAS
.. index:: CONFIGURE_SHELL_COMMAND_ALIAS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_ALIAS`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_ALIAS`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_alias

PROGRAMMING INFORMATION:
    The ``alias`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_alias(
            int    argc,
            char **argv
        );

    The configuration structure for the ``alias`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_ALIAS_Command;

.. raw:: latex

   \clearpage

.. _cmdls:

cmdls - List commands
---------------------
.. index:: cmdls

SYNOPSYS:
    .. code-block:: shell

        cmdls COMMAND...

DESCRIPTION:
    This command lists the visible commands of the command set.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The current user must have read permission to list a command.

EXAMPLES:
    The following is an example of how to use ``cmdls``:

    .. code-block:: shell

        SHLL [/] # cmdls help shutdown
        r-xr-xr-x     0     0 help
        r-x------     0     0 shutdown

.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDLS
.. index:: CONFIGURE_SHELL_COMMAND_CMDLS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDLS`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CMDLS`` when all shell commands have been
    configured.

PROGRAMMING INFORMATION:
    The configuration structure for the ``cmdls`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CMDLS_Command;

.. raw:: latex

   \clearpage

.. _cmdchown:

cmdchown - Change user or owner of commands
-------------------------------------------
.. index:: cmdchown

SYNOPSYS:
    .. code-block:: shell

        cmdchown [OWNER][:[GROUP]] COMMAND...

DESCRIPTION:
    This command changes the user or owner of a command.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The current user must have an UID of zero or be the command owner to change
    the owner or group.

EXAMPLES:
    The following is an example of how to use ``cmdchown``:

    .. code-block:: shell

        [/] # cmdls help
        r-xr-xr-x     0     0 help
        [/] # cmdchown 1:1 help
        [/] # cmdls help
        r--r--r--     1     1 help

.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN
.. index:: CONFIGURE_SHELL_COMMAND_CMDCHOWN

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHOWN`` to have
    this command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN`` when all shell commands have been
    configured.

PROGRAMMING INFORMATION:
    The configuration structure for the ``cmdchown`` has the following
    prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CMDCHOWN_Command;

.. raw:: latex

   \clearpage

.. _cmdchmod:

cmdchmod - Change mode of commands
----------------------------------
.. index:: cmdchmod

SYNOPSYS:
    .. code-block:: shell

        cmdchmod OCTAL-MODE COMMAND...

DESCRIPTION:
    This command changes the mode of a command.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The current user must have an UID of zero or be the command owner to change
    the mode.

EXAMPLES:
    The following is an example of how to use ``cmdchmod``:

    .. code-block:: shell

        [/] # cmdls help
        r-xr-xr-x     0     0 help
        [/] # cmdchmod 544 help
        [/] # cmdls help
        r-xr--r--     0     0 help

.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD
.. index:: CONFIGURE_SHELL_COMMAND_CMDCHMOD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHMOD`` to have
    this command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD`` when all shell commands have been
    configured.

PROGRAMMING INFORMATION:
    The configuration structure for the ``cmdchmod`` has the following
    prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CMDCHMOD_Command;

.. raw:: latex

   \clearpage

.. _date:

date - print or set current date and time
-----------------------------------------
.. index:: date

SYNOPSYS:
    .. code-block:: shell

        date
        date DATE TIME

DESCRIPTION:
    This command operates one of two modes.  When invoked with no arguments, it
    prints the current date and time.  When invoked with both ``date`` and
    ``time`` arguments, it sets the current time.

    The ``date`` is specified in ``YYYY-MM-DD`` format.
    The ``time`` is specified in ``HH:MM:SS`` format.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``date``:

    .. code-block:: shell

        SHLL [/] $ date
        Fri Jan  1 00:00:09 1988
        SHLL [/] $ date 2008-02-29 06:45:32
        SHLL [/] $ date
        Fri Feb 29 06:45:35 2008

.. index:: CONFIGURE_SHELL_NO_COMMAND_DATE
.. index:: CONFIGURE_SHELL_COMMAND_DATE

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_DATE`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_DATE`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_date

PROGRAMMING INFORMATION:
    The ``date`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_date(
            int    argc,
            char **argv
        );

    The configuration structure for the ``date`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_DATE_Command;

.. raw:: latex

   \clearpage

.. _echo:

echo - produce message in a shell script
----------------------------------------
.. index:: echo

SYNOPSYS:
    .. code-block:: shell

        echo [-n | -e] args ...

DESCRIPTION:
    Echo prints its arguments on the standard output, separated by spaces.
    Unless the *-n* option is present, a newline is output following the
    arguments.  The *-e* option causes echo to treat the escape sequences
    specially, as described in the following paragraph.  The *-e* option is the
    default, and is provided solely for compatibility with other systems.  Only
    one of the options *-n* and *-e* may be given.

    If any of the following sequences of characters is encountered during
    output, the sequence is not output.  Instead, the specified action is
    performed:

    *\b*
        A backspace character is output.

    *\c*
        Subsequent output is suppressed.  This is normally used at the end of
        the last argument to suppress the trailing newline that echo would
        otherwise output.

    *\f*
        Output a form feed.

    *\n*
        Output a newline character.

    *\r*
        Output a carriage return.

    *\t*
        Output a (horizontal) tab character.

    *\v*
        Output a vertical tab.

    *\0digits*
        Output the character whose value is given by zero to three digits.  If
        there are zero digits, a nul character is output.

    *\\*
        Output a backslash.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The octal character escape mechanism (\0digits) differs from the C language
    mechanism.

    There is no way to force ``echo`` to treat its arguments literally, rather
    than interpreting them as options and escape sequences.

EXAMPLES:
    The following is an example of how to use ``echo``:

    .. code-block:: shell

        SHLL [/] $ echo a b c
        a b c
        SHLL [/] $ echo

.. index:: CONFIGURE_SHELL_NO_COMMAND_ECHO
.. index:: CONFIGURE_SHELL_COMMAND_ECHO

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_ECHO`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_ECHO`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_echo

PROGRAMMING INFORMATION:
    The ``echo`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_echo(
            int    argc,
            char **argv
        );

    The configuration structure for the ``echo`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_ECHO_Command;

ORIGIN:
    The implementation and portions of the documentation for this command are
    from NetBSD 4.0.

.. raw:: latex

   \clearpage

.. _sleep:

sleep - delay for a specified amount of time
--------------------------------------------
.. index:: sleep

SYNOPSYS:
    .. code-block:: shell

        sleep seconds
        sleep seconds nanoseconds

DESCRIPTION:
    This command causes the task executing the shell to block for the specified
    number of ``seconds`` and ``nanoseconds``.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    This command is implemented using the ``nanosleep()`` method.

    The command line interface is similar to the ``sleep`` command found on
    POSIX systems but the addition of the ``nanoseconds`` parameter allows fine
    grained delays in shell scripts without adding another command such as
    ``usleep``.

EXAMPLES:
    The following is an example of how to use ``sleep``:

    .. code-block:: shell

        SHLL [/] $ sleep 10
        SHLL [/] $ sleep 0 5000000

    It is not clear from the above but there is a ten second pause after
    executing the first command before the prompt is printed.  The second
    command completes very quickly from a human perspective and there is no
    noticeable delay in the prompt being printed.

.. index:: CONFIGURE_SHELL_NO_COMMAND_SLEEP
.. index:: CONFIGURE_SHELL_COMMAND_SLEEP

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_SLEEP`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_SLEEP`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_sleep

PROGRAMMING INFORMATION:
    The ``sleep`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_sleep(
            int    argc,
            char **argv
        );

    The configuration structure for the ``sleep`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_SLEEP_Command;

.. raw:: latex

   \clearpage

.. _id:

id - show uid gid euid and egid
-------------------------------
.. index:: id

SYNOPSYS:
    .. code-block:: shell

        id

DESCRIPTION:
    This command prints the user identity.  This includes the user id (uid),
    group id (gid), effective user id (euid), and effective group id (egid).

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    Remember there is only one POSIX process in a single processor RTEMS
    application. Each thread may have its own user identity and that identity
    is used by the filesystem to enforce permissions.

EXAMPLES:
    The first example of the ``id`` command is from a session logged
    in as the normal user ``rtems``:

    .. code-block:: shell

        SHLL [/] # id
        uid=1(rtems),gid=1(rtems),euid=1(rtems),egid=1(rtems)

    The second example of the ``id`` command is from a session logged in as the
    ``root`` user:

    .. code-block:: shell

        SHLL [/] # id
        uid=0(root),gid=0(root),euid=0(root),egid=0(root)

.. index:: CONFIGURE_SHELL_NO_COMMAND_ID
.. index:: CONFIGURE_SHELL_COMMAND_ID

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_ID`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_ID`` when all shell commands have been configured.

.. index:: rtems_shell_rtems_main_id

PROGRAMMING INFORMATION:
    The ``id`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_id(
            int    argc,
            char **argv
        );

    The configuration structure for the ``id`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_ID_Command;

.. raw:: latex

   \clearpage

.. _tty:

tty - show ttyname
------------------
.. index:: tty

SYNOPSYS:
    .. code-block:: shell

        tty

DESCRIPTION:
    This command prints the file name of the device connected to standard
    input.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``tty``:

    .. code-block:: shell

        SHLL [/] $ tty
        /dev/console

.. index:: CONFIGURE_SHELL_NO_COMMAND_TTY
.. index:: CONFIGURE_SHELL_COMMAND_TTY

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_TTY`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_TTY`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_tty

PROGRAMMING INFORMATION:
    The ``tty`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_tty(
            int    argc,
            char **argv
        );

    The configuration structure for the ``tty`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_TTY_Command;

.. raw:: latex

   \clearpage

.. _whoami:

whoami - print effective user id
--------------------------------
.. index:: whoami

SYNOPSYS:
    .. code-block:: shell

        whoami

DESCRIPTION:
    This command displays the user name associated with the current effective
    user
    id.

EXIT STATUS:
    This command always succeeds.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``whoami``:

    .. code-block:: shell

        SHLL [/] $ whoami
        rtems

.. index:: CONFIGURE_SHELL_NO_COMMAND_WHOAMI
.. index:: CONFIGURE_SHELL_COMMAND_WHOAMI

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_WHOAMI`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_WHOAMI`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_whoami

PROGRAMMING INFORMATION:
    The ``whoami`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_whoami(
            int    argc,
            char **argv
        );

    The configuration structure for the ``whoami`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_WHOAMI_Command;

.. raw:: latex

   \clearpage

.. _getenv:

getenv - print environment variable
-----------------------------------
.. index:: getenv

SYNOPSYS:
    .. code-block:: shell

        getenv variable

DESCRIPTION:
    This command is used to display the value of a ``variable`` in the set of
    environment variables.

EXIT STATUS:
    This command will return 1 and print a diagnostic message if a failure
    occurs.

NOTES:
    The entire RTEMS application shares a single set of environment variables.

EXAMPLES:
    The following is an example of how to use ``getenv``:

    .. code-block:: shell

        SHLL [/] $ getenv BASEPATH
        /mnt/hda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_GETENV
.. index:: CONFIGURE_SHELL_COMMAND_GETENV

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_GETENV`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_GETENV`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_getenv

PROGRAMMING INFORMATION:
    The ``getenv`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_getenv(
            int    argc,
            char **argv
        );

    The configuration structure for the ``getenv`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_GETENV_Command;

.. raw:: latex

   \clearpage

.. _setenv:

setenv - set environment variable
---------------------------------
.. index:: setenv

SYNOPSYS:
    .. code-block:: shell

        setenv variable [value]

DESCRIPTION:
    This command is used to add a new ``variable`` to the set of environment
    variables or to modify the variable of an already existing ``variable``.
    If the ``value`` is not provided, the ``variable`` will be set to the empty
    string.

EXIT STATUS:
    This command will return 1 and print a diagnostic message if a failure
    occurs.

NOTES:
    The entire RTEMS application shares a single set of environment variables.

EXAMPLES:
    The following is an example of how to use ``setenv``:

    .. code-block:: shell

        SHLL [/] $ setenv BASEPATH /mnt/hda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_SETENV
.. index:: CONFIGURE_SHELL_COMMAND_SETENV

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_SETENV`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_SETENV`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_setenv

PROGRAMMING INFORMATION:
    The ``setenv`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_setenv(
            int    argc,
            char **argv
        );

    The configuration structure for the ``setenv`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_SETENV_Command;

.. raw:: latex

   \clearpage

.. _unsetenv:

unsetenv - unset environment variable
-------------------------------------
.. index:: unsetenv

SYNOPSYS:
    .. code-block:: shell

        unsetenv variable

DESCRIPTION:
    This command is remove to a ``variable`` from the set of environment
    variables.

EXIT STATUS:
    This command will return 1 and print a diagnostic message if a failure
    occurs.

NOTES:
    The entire RTEMS application shares a single set of environment variables.

EXAMPLES:
    The following is an example of how to use ``unsetenv``:

    .. code-block:: shell

        SHLL [/] $ unsetenv BASEPATH

.. index:: CONFIGURE_SHELL_NO_COMMAND_UNSETENV
.. index:: CONFIGURE_SHELL_COMMAND_UNSETENV

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_UNSETENV`` to have
    this command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_UNSETENV`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_unsetenv

PROGRAMMING INFORMATION:
    The ``unsetenv`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_unsetenv(
            int    argc,
            char **argv
        );

    The configuration structure for the ``unsetenv`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_UNSETENV_Command;

.. raw:: latex

   \clearpage

.. _time:

time - time command execution
-----------------------------
.. index:: time

SYNOPSYS:
    .. code-block:: shell

        time command [argument ...]

DESCRIPTION:
    The time command executes and times a command.  After the command finishes,
    time writes the total time elapsed.  Times are reported in seconds.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``time``:

    .. code-block:: shell

        SHLL [/] $ time cp -r /nfs/directory /c

.. index:: CONFIGURE_SHELL_NO_COMMAND_TIME
.. index:: CONFIGURE_SHELL_COMMAND_TIME

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_TIME`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_TIME`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_time

PROGRAMMING INFORMATION:
    The ``time`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_time(
            int    argc,
            char **argv
        );

    The configuration structure for the ``time`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_TIME_Command;

.. raw:: latex

   \clearpage

.. _logoff:

logoff - logoff from the system
-------------------------------
.. index:: logoff

SYNOPSYS:
    .. code-block:: shell

        logoff

DESCRIPTION:
    This command logs the user out of the shell.

EXIT STATUS:
    This command does not return.

NOTES:
    The system behavior when the shell is exited depends upon how the shell was
    initiated.  The typical behavior is that a login prompt will be displayed
    for the next login attempt or that the connection will be dropped by the
    RTEMS system.

EXAMPLES:
    The following is an example of how to use ``logoff``:

    .. code-block:: shell

        SHLL [/] $ logoff
        logoff from the system...

.. index:: CONFIGURE_SHELL_NO_COMMAND_LOGOFF
.. index:: CONFIGURE_SHELL_COMMAND_LOGOFF

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_LOGOFF`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_LOGOFF`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_logoff

PROGRAMMING INFORMATION:
    The ``logoff`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_logoff(
            int    argc,
            char **argv
        );

    The configuration structure for the ``logoff`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command;

.. raw:: latex

   \clearpage

.. _rtc:

rtc - RTC driver configuration
------------------------------
.. index:: rtc

SYNOPSYS:
    .. code-block:: shell

        rtc

.. index:: CONFIGURE_SHELL_NO_COMMAND_RTC
.. index:: CONFIGURE_SHELL_COMMAND_RTC

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_RTC`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_RTC`` when all shell commands have been
    configured.

.. raw:: latex

   \clearpage

.. _exit:

exit - exit the shell
---------------------
.. index:: exit

SYNOPSYS:
    .. code-block:: shell

        exit

DESCRIPTION:
    This command causes the shell interpreter to ``exit``.

EXIT STATUS:
    This command does not return.

NOTES:
    In contrast to `logoff - logoff from the system`, this command is built
    into the shell interpreter loop.

EXAMPLES:
    The following is an example of how to use ``exit``:

    .. code-block:: shell

        SHLL [/] $ exit
        Shell exiting

CONFIGURATION:
    This command is always present and cannot be disabled.

PROGRAMMING INFORMATION:
    The ``exit`` is implemented directly in the shell interpreter.  There is no
    C routine associated with it.