source: rtems-docs/shell/general_commands.rst @ a6b837e

4.115am
Last change on this file since a6b837e was a6b837e, checked in by Chris Johns <chrisj@…>, on 01/17/16 at 03:40:03

Clean up of general commands.

  • Property mode set to 100644
File size: 26.9 KB
Line 
1General Commands
2################
3
4Introduction
5============
6
7The RTEMS shell has the following general commands:
8
9- ``help`` - Print command help
10
11- ``alias`` - Add alias for an existing command
12
13- ``cmdls`` - List commands
14
15- ``cmdchown`` - Change user or owner of commands
16
17- ``cmdchmod`` - Change mode of commands
18
19- ``date`` - Print or set current date and time
20
21- ``echo`` - Produce message in a shell script
22
23- ``sleep`` - Delay for a specified amount of time
24
25- ``id`` - show uid gid euid and egid
26
27- ``tty`` - show ttyname
28
29- ``whoami`` - print effective user id
30
31- ``getenv`` - print environment variable
32
33- ``setenv`` - set environment variable
34
35- ``unsetenv`` - unset environment variable
36
37- ``time`` - time command execution
38
39- ``logoff`` - logoff from the system
40
41- ``rtc`` - RTC driver configuration
42
43- ``exit`` - alias for logoff command
44
45Commands
46========
47
48This section details the General Commands available.  A subsection is dedicated
49to each of the commands and describes the behavior and configuration of that
50command as well as providing an example usage.
51
52help - Print command help
53-------------------------
54.. index:: help
55
56**SYNOPSYS:**
57
58.. code:: shell
59
60    help misc
61
62**DESCRIPTION:**
63
64This command prints the command help. Help without arguments prints a list of
65topics and help with a topic prints the help for that topic.
66
67**EXIT STATUS:**
68
69This command returns 0.
70
71**NOTES:**
72
73The help print will break the output up based on the environment variable
74SHELL_LINES. If this environment variable is not set the default is 16
75lines. If set the number of lines is set to that the value. If the shell lines
76is set 0 there will be no break.
77
78**EXAMPLES:**
79
80The following is an example of how to use ``alias``:
81
82.. code:: shell
83
84    SHLL [/] $ help
85    help: ('r' repeat last cmd - 'e' edit last cmd)
86    TOPIC? The topics are
87    mem, misc, files, help, rtems, network, monitor
88    SHLL [/] $ help misc
89    help: list for the topic 'misc'
90    alias        - alias old new
91    time         - time command [arguments...]
92    joel         - joel [args] SCRIPT
93    date         - date [YYYY-MM-DD HH:MM:SS]
94    echo         - echo [args]
95    sleep        - sleep seconds [nanoseconds]
96    id           - show uid, gid, euid, and egid
97    tty          - show ttyname
98    whoami       - show current user
99    logoff       - logoff from the system
100    setenv       - setenv [var] [string]
101    getenv       - getenv [var]
102    unsetenv     - unsetenv [var]
103    umask        - umask [new_umask]
104    Press any key to continue...
105    rtc          - real time clock read and set
106    SHLL [/] $ setenv SHELL_ENV 0
107    SHLL [/] $ help misc
108    help: list for the topic 'misc'
109    alias        - alias old new
110    time         - time command [arguments...]
111    joel         - joel [args] SCRIPT
112    date         - date [YYYY-MM-DD HH:MM:SS]
113    echo         - echo [args]
114    sleep        - sleep seconds [nanoseconds]
115    id           - show uid, gid, euid, and egid
116    tty          - show ttyname
117    whoami       - show current user
118    logoff       - logoff from the system
119    setenv       - setenv [var] [string]
120    getenv       - getenv [var]
121    unsetenv     - unsetenv [var]
122    umask        - umask [new_umask]
123    rtc          - real time clock read and set
124
125**CONFIGURATION:**
126
127This command has no configuration.
128
129alias - add alias for an existing command
130-----------------------------------------
131.. index:: alias
132
133**SYNOPSYS:**
134
135.. code:: shell
136
137    alias oldCommand newCommand
138
139**DESCRIPTION:**
140
141This command adds an alternate name for an existing command to the command set.
142
143**EXIT STATUS:**
144
145This command returns 0 on success and non-zero if an error is encountered.
146
147**NOTES:**
148
149None.
150
151**EXAMPLES:**
152
153The following is an example of how to use ``alias``:
154
155.. code:: shell
156
157    SHLL [/] $ me
158    shell:me command not found
159    SHLL [/] $ alias whoami me
160    SHLL [/] $ me
161    rtems
162    SHLL [/] $ whoami
163    rtems
164
165**CONFIGURATION:**
166
167.. index:: CONFIGURE_SHELL_NO_COMMAND_ALIAS
168.. index:: CONFIGURE_SHELL_COMMAND_ALIAS
169
170This command is included in the default shell command set.  When building a
171custom command set, define ``CONFIGURE_SHELL_COMMAND_ALIAS`` to have this
172command included.
173
174This command can be excluded from the shell command set by defining
175``CONFIGURE_SHELL_NO_COMMAND_ALIAS`` when all shell commands have been
176configured.
177
178**PROGRAMMING INFORMATION:**
179
180.. index:: rtems_shell_rtems_main_alias
181
182The ``alias`` is implemented by a C language function which has the following
183prototype:
184
185.. code:: c
186
187    int rtems_shell_rtems_main_alias(
188        int    argc,
189        char **argv
190    );
191
192The configuration structure for the ``alias`` has the following prototype:
193
194.. code:: c
195
196    extern rtems_shell_cmd_t rtems_shell_ALIAS_Command;
197
198cmdls - List commands
199---------------------
200.. index:: cmdls
201
202**SYNOPSYS:**
203
204.. code:: shell
205
206    cmdls COMMAND...
207
208**DESCRIPTION:**
209
210This command lists the visible commands of the command set.
211
212**EXIT STATUS:**
213
214This command returns 0 on success and non-zero if an error is encountered.
215
216**NOTES:**
217
218The current user must have read permission to list a command.
219
220**EXAMPLES:**
221
222The following is an example of how to use ``cmdls``:
223
224.. code:: shell
225
226    SHLL [/] # cmdls help shutdown
227    r-xr-xr-x     0     0 help
228    r-x------     0     0 shutdown
229
230**CONFIGURATION:**
231
232.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDLS
233.. index:: CONFIGURE_SHELL_COMMAND_CMDLS
234
235This command is included in the default shell command set.  When building a
236custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDLS`` to have this
237command included.
238
239This command can be excluded from the shell command set by defining
240``CONFIGURE_SHELL_NO_COMMAND_CMDLS`` when all shell commands have been
241configured.
242
243**PROGRAMMING INFORMATION:**
244
245The configuration structure for the ``cmdls`` has the following prototype:
246
247.. code:: c
248
249    extern rtems_shell_cmd_t rtems_shell_CMDLS_Command;
250
251cmdchown - Change user or owner of commands
252-------------------------------------------
253.. index:: cmdchown
254
255**SYNOPSYS:**
256
257.. code:: shell
258
259    cmdchown [OWNER][:[GROUP]] COMMAND...
260
261**DESCRIPTION:**
262
263This command changes the user or owner of a command.
264
265**EXIT STATUS:**
266
267This command returns 0 on success and non-zero if an error is encountered.
268
269**NOTES:**
270
271The current user must have an UID of zero or be the command owner to change the
272owner or group.
273
274**EXAMPLES:**
275
276The following is an example of how to use ``cmdchown``:
277
278.. code:: shell
279
280    [/] # cmdls help
281    r-xr-xr-x     0     0 help
282    [/] # cmdchown 1:1 help
283    [/] # cmdls help
284    r--r--r--     1     1 help
285
286**CONFIGURATION:**
287
288.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN
289.. index:: CONFIGURE_SHELL_COMMAND_CMDCHOWN
290
291This command is included in the default shell command set.  When building a
292custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHOWN`` to have this
293command included.
294
295This command can be excluded from the shell command set by defining
296``CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN`` when all shell commands have been
297configured.
298
299**PROGRAMMING INFORMATION:**
300
301The configuration structure for the ``cmdchown`` has the following prototype:
302
303.. code:: c
304
305    extern rtems_shell_cmd_t rtems_shell_CMDCHOWN_Command;
306
307cmdchmod - Change mode of commands
308----------------------------------
309.. index:: cmdchmod
310
311**SYNOPSYS:**
312
313.. code:: shell
314
315    cmdchmod OCTAL-MODE COMMAND...
316
317**DESCRIPTION:**
318
319This command changes the mode of a command.
320
321**EXIT STATUS:**
322
323This command returns 0 on success and non-zero if an error is encountered.
324
325**NOTES:**
326
327The current user must have an UID of zero or be the command owner to change the
328mode.
329
330**EXAMPLES:**
331
332The following is an example of how to use ``cmdchmod``:
333
334.. code:: shell
335
336    [/] # cmdls help
337    r-xr-xr-x     0     0 help
338    [/] # cmdchmod 544 help
339    [/] # cmdls help
340    r-xr--r--     0     0 help
341
342**CONFIGURATION:**
343
344.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD
345.. index:: CONFIGURE_SHELL_COMMAND_CMDCHMOD
346
347This command is included in the default shell command set.  When building a
348custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHMOD`` to have this
349command included.
350
351This command can be excluded from the shell command set by defining
352``CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD`` when all shell commands have been
353configured.
354
355**PROGRAMMING INFORMATION:**
356
357The configuration structure for the ``cmdchmod`` has the following prototype:
358
359.. code:: c
360
361    extern rtems_shell_cmd_t rtems_shell_CMDCHMOD_Command;
362
363date - print or set current date and time
364-----------------------------------------
365.. index:: date
366
367**SYNOPSYS:**
368
369.. code:: shell
370
371    date
372    date DATE TIME
373
374**DESCRIPTION:**
375
376This command operates one of two modes.  When invoked with no arguments, it
377prints the current date and time.  When invoked with both ``date`` and ``time``
378arguments, it sets the current time.
379
380The ``date`` is specified in ``YYYY-MM-DD`` format.
381The ``time`` is specified in ``HH:MM:SS`` format.
382
383**EXIT STATUS:**
384
385This command returns 0 on success and non-zero if an error is encountered.
386
387**NOTES:**
388
389None.
390
391**EXAMPLES:**
392
393The following is an example of how to use ``date``:
394
395.. code:: shell
396
397    SHLL [/] $ date
398    Fri Jan  1 00:00:09 1988
399    SHLL [/] $ date 2008-02-29 06:45:32
400    SHLL [/] $ date
401    Fri Feb 29 06:45:35 2008
402
403**CONFIGURATION:**
404
405.. index:: CONFIGURE_SHELL_NO_COMMAND_DATE
406.. index:: CONFIGURE_SHELL_COMMAND_DATE
407
408This command is included in the default shell command set.  When building a
409custom command set, define ``CONFIGURE_SHELL_COMMAND_DATE`` to have this command
410included.
411
412This command can be excluded from the shell command set by defining
413``CONFIGURE_SHELL_NO_COMMAND_DATE`` when all shell commands have been
414configured.
415
416**PROGRAMMING INFORMATION:**
417
418.. index:: rtems_shell_rtems_main_date
419
420The ``date`` is implemented by a C language function which has the following
421prototype:
422
423.. code:: c
424
425    int rtems_shell_rtems_main_date(
426        int    argc,
427        char **argv
428    );
429
430The configuration structure for the ``date`` has the following prototype:
431
432.. code:: c
433
434    extern rtems_shell_cmd_t rtems_shell_DATE_Command;
435
436echo - produce message in a shell script
437----------------------------------------
438.. index:: echo
439
440**SYNOPSYS:**
441
442.. code:: shell
443
444    echo [-n | -e] args ...
445
446**DESCRIPTION:**
447
448Echo prints its arguments on the standard output, separated by spaces.  Unless
449the *-n* option is present, a newline is output following the arguments.  The
450*-e* option causes echo to treat the escape sequences specially, as described
451in the following paragraph.  The *-e* option is the default, and is provided
452solely for compatibility with other systems.  Only one of the options *-n* and
453*-e* may be given.
454
455If any of the following sequences of characters is encountered during output,
456the sequence is not output.  Instead, the specified action is performed:
457
458*\\b*
459    A backspace character is output.
460
461*\\c*
462    Subsequent output is suppressed.  This is normally used at the end of the
463    last argument to suppress the trailing newline that echo would otherwise
464    output.
465
466*\\f*
467    Output a form feed.
468
469*\\n*
470    Output a newline character.
471
472*\\r*
473    Output a carriage return.
474
475*\\t*
476    Output a (horizontal) tab character.
477
478*\\v*
479    Output a vertical tab.
480
481*\\0digits*
482    Output the character whose value is given by zero to three digits.  If
483    there are zero digits, a nul character is output.
484
485*\\\\*
486    Output a backslash.
487
488**EXIT STATUS:**
489
490This command returns 0 on success and non-zero if an error is encountered.
491
492**NOTES:**
493
494The octal character escape mechanism (\\0digits) differs from the C language
495mechanism.
496
497There is no way to force ``echo`` to treat its arguments literally, rather than
498interpreting them as options and escape sequences.
499
500**EXAMPLES:**
501
502The following is an example of how to use ``echo``:
503
504.. code:: shell
505
506    SHLL [/] $ echo a b c
507    a b c
508    SHLL [/] $ echo
509
510**CONFIGURATION:**
511
512.. index:: CONFIGURE_SHELL_NO_COMMAND_ECHO
513.. index:: CONFIGURE_SHELL_COMMAND_ECHO
514
515This command is included in the default shell command set.  When building a
516custom command set, define ``CONFIGURE_SHELL_COMMAND_ECHO`` to have this command
517included.
518
519This command can be excluded from the shell command set by defining
520``CONFIGURE_SHELL_NO_COMMAND_ECHO`` when all shell commands have been
521configured.
522
523**PROGRAMMING INFORMATION:**
524
525.. index:: rtems_shell_rtems_main_echo
526
527The ``echo`` is implemented by a C language function which has the following
528prototype:
529
530.. code:: c
531
532    int rtems_shell_rtems_main_echo(
533        int    argc,
534        char **argv
535    );
536
537The configuration structure for the ``echo`` has the following prototype:
538
539.. code:: c
540
541    extern rtems_shell_cmd_t rtems_shell_ECHO_Command;
542
543**ORIGIN:**
544
545The implementation and portions of the documentation for this command are from
546NetBSD 4.0.
547
548sleep - delay for a specified amount of time
549--------------------------------------------
550.. index:: sleep
551
552**SYNOPSYS:**
553
554.. code:: shell
555
556    sleep seconds
557    sleep seconds nanoseconds
558
559**DESCRIPTION:**
560
561This command causes the task executing the shell to block for the specified
562number of ``seconds`` and ``nanoseconds``.
563
564**EXIT STATUS:**
565
566This command returns 0 on success and non-zero if an error is encountered.
567
568**NOTES:**
569
570This command is implemented using the ``nanosleep()`` method.
571
572The command line interface is similar to the ``sleep`` command found on POSIX
573systems but the addition of the ``nanoseconds`` parameter allows fine grained
574delays in shell scripts without adding another command such as ``usleep``.
575
576**EXAMPLES:**
577
578The following is an example of how to use ``sleep``:
579
580.. code:: shell
581
582    SHLL [/] $ sleep 10
583    SHLL [/] $ sleep 0 5000000
584
585It is not clear from the above but there is a ten second pause after executing
586the first command before the prompt is printed.  The second command completes
587very quickly from a human perspective and there is no noticeable delay in the
588prompt being printed.
589
590**CONFIGURATION:**
591
592.. index:: CONFIGURE_SHELL_NO_COMMAND_SLEEP
593.. index:: CONFIGURE_SHELL_COMMAND_SLEEP
594
595This command is included in the default shell command set.  When building a
596custom command set, define ``CONFIGURE_SHELL_COMMAND_SLEEP`` to have this
597command included.
598
599This command can be excluded from the shell command set by defining
600``CONFIGURE_SHELL_NO_COMMAND_SLEEP`` when all shell commands have been
601configured.
602
603**PROGRAMMING INFORMATION:**
604
605.. index:: rtems_shell_rtems_main_sleep
606
607The ``sleep`` is implemented by a C language function which has the following
608prototype:
609
610.. code:: c
611
612    int rtems_shell_rtems_main_sleep(
613        int    argc,
614        char **argv
615    );
616
617The configuration structure for the ``sleep`` has the following prototype:
618
619.. code:: c
620
621    extern rtems_shell_cmd_t rtems_shell_SLEEP_Command;
622
623id - show uid gid euid and egid
624-------------------------------
625.. index:: id
626
627**SYNOPSYS:**
628
629.. code:: shell
630
631    id
632
633**DESCRIPTION:**
634
635This command prints the user identity.  This includes the user id (uid), group
636id (gid), effective user id (euid), and effective group id (egid).
637
638**EXIT STATUS:**
639
640This command returns 0 on success and non-zero if an error is encountered.
641
642**NOTES:**
643
644Remember there is only one POSIX process in a single processor RTEMS
645application. Each thread may have its own user identity and that identity is
646used by the filesystem to enforce permissions.
647
648**EXAMPLES:**
649
650The first example of the ``id`` command is from a session logged
651in as the normal user ``rtems``:
652
653.. code:: shell
654
655    SHLL [/] # id
656    uid=1(rtems),gid=1(rtems),euid=1(rtems),egid=1(rtems)
657
658The second example of the ``id`` command is from a session logged in as the
659``root`` user:
660
661.. code:: shell
662
663    SHLL [/] # id
664    uid=0(root),gid=0(root),euid=0(root),egid=0(root)
665
666**CONFIGURATION:**
667
668.. index:: CONFIGURE_SHELL_NO_COMMAND_ID
669.. index:: CONFIGURE_SHELL_COMMAND_ID
670
671This command is included in the default shell command set.  When building a
672custom command set, define ``CONFIGURE_SHELL_COMMAND_ID`` to have this command
673included.
674
675This command can be excluded from the shell command set by defining
676``CONFIGURE_SHELL_NO_COMMAND_ID`` when all shell commands have been configured.
677
678**PROGRAMMING INFORMATION:**
679
680.. index:: rtems_shell_rtems_main_id
681
682The ``id`` is implemented by a C language function which has the following
683prototype:
684
685.. code:: c
686
687    int rtems_shell_rtems_main_id(
688        int    argc,
689        char **argv
690    );
691
692The configuration structure for the ``id`` has the following prototype:
693
694.. code:: c
695
696    extern rtems_shell_cmd_t rtems_shell_ID_Command;
697
698tty - show ttyname
699------------------
700.. index:: tty
701
702**SYNOPSYS:**
703
704.. code:: shell
705
706    tty
707
708**DESCRIPTION:**
709
710This command prints the file name of the device connected to standard input.
711
712**EXIT STATUS:**
713
714This command returns 0 on success and non-zero if an error is encountered.
715
716**NOTES:**
717
718NONE
719
720**EXAMPLES:**
721
722The following is an example of how to use ``tty``:
723
724.. code:: shell
725
726    SHLL [/] $ tty
727    /dev/console
728
729**CONFIGURATION:**
730
731.. index:: CONFIGURE_SHELL_NO_COMMAND_TTY
732.. index:: CONFIGURE_SHELL_COMMAND_TTY
733
734This command is included in the default shell command set.  When building a
735custom command set, define ``CONFIGURE_SHELL_COMMAND_TTY`` to have this command
736included.
737
738This command can be excluded from the shell command set by defining
739``CONFIGURE_SHELL_NO_COMMAND_TTY`` when all shell commands have been
740configured.
741
742**PROGRAMMING INFORMATION:**
743
744.. index:: rtems_shell_rtems_main_tty
745
746The ``tty`` is implemented by a C language function which has the following
747prototype:
748
749.. code:: c
750
751    int rtems_shell_rtems_main_tty(
752        int    argc,
753        char **argv
754    );
755
756The configuration structure for the ``tty`` has the following prototype:
757
758.. code:: c
759
760    extern rtems_shell_cmd_t rtems_shell_TTY_Command;
761
762whoami - print effective user id
763--------------------------------
764.. index:: whoami
765
766**SYNOPSYS:**
767
768.. code:: shell
769
770    whoami
771
772**DESCRIPTION:**
773
774This command displays the user name associated with the current effective user
775id.
776
777**EXIT STATUS:**
778
779This command always succeeds.
780
781**NOTES:**
782
783None.
784
785**EXAMPLES:**
786
787The following is an example of how to use ``whoami``:
788
789.. code:: shell
790
791    SHLL [/] $ whoami
792    rtems
793
794**CONFIGURATION:**
795
796.. index:: CONFIGURE_SHELL_NO_COMMAND_WHOAMI
797.. index:: CONFIGURE_SHELL_COMMAND_WHOAMI
798
799This command is included in the default shell command set.  When building a
800custom command set, define ``CONFIGURE_SHELL_COMMAND_WHOAMI`` to have this
801command included.
802
803This command can be excluded from the shell command set by defining
804``CONFIGURE_SHELL_NO_COMMAND_WHOAMI`` when all shell commands have been
805configured.
806
807**PROGRAMMING INFORMATION:**
808
809.. index:: rtems_shell_rtems_main_whoami
810
811The ``whoami`` is implemented by a C language function which has the following
812prototype:
813
814.. code:: c
815
816    int rtems_shell_rtems_main_whoami(
817        int    argc,
818        char **argv
819    );
820
821The configuration structure for the ``whoami`` has the following prototype:
822
823.. code:: c
824
825    extern rtems_shell_cmd_t rtems_shell_WHOAMI_Command;
826
827getenv - print environment variable
828-----------------------------------
829.. index:: getenv
830
831**SYNOPSYS:**
832
833.. code:: shell
834
835    getenv variable
836
837**DESCRIPTION:**
838
839This command is used to display the value of a ``variable`` in the set of
840environment variables.
841
842**EXIT STATUS:**
843
844This command will return 1 and print a diagnostic message if a failure occurs.
845
846**NOTES:**
847
848The entire RTEMS application shares a single set of environment variables.
849
850**EXAMPLES:**
851
852The following is an example of how to use ``getenv``:
853
854.. code:: shell
855
856    SHLL [/] $ getenv BASEPATH
857    /mnt/hda1
858
859**CONFIGURATION:**
860
861.. index:: CONFIGURE_SHELL_NO_COMMAND_GETENV
862.. index:: CONFIGURE_SHELL_COMMAND_GETENV
863
864This command is included in the default shell command set.  When building a
865custom command set, define ``CONFIGURE_SHELL_COMMAND_GETENV`` to have this
866command included.
867
868This command can be excluded from the shell command set by defining
869``CONFIGURE_SHELL_NO_COMMAND_GETENV`` when all shell commands have been
870configured.
871
872**PROGRAMMING INFORMATION:**
873
874.. index:: rtems_shell_rtems_main_getenv
875
876The ``getenv`` is implemented by a C language function which has the following
877prototype:
878
879.. code:: c
880
881    int rtems_shell_rtems_main_getenv(
882        int    argc,
883        char **argv
884    );
885
886The configuration structure for the ``getenv`` has the following prototype:
887
888.. code:: c
889
890    extern rtems_shell_cmd_t rtems_shell_GETENV_Command;
891
892setenv - set environment variable
893---------------------------------
894.. index:: setenv
895
896**SYNOPSYS:**
897
898.. code:: shell
899
900    setenv variable [value]
901
902**DESCRIPTION:**
903
904This command is used to add a new ``variable`` to the set of environment
905variables or to modify the variable of an already existing ``variable``.  If
906the ``value`` is not provided, the ``variable`` will be set to the empty
907string.
908
909**EXIT STATUS:**
910
911This command will return 1 and print a diagnostic message if a failure occurs.
912
913**NOTES:**
914
915The entire RTEMS application shares a single set of environment variables.
916
917**EXAMPLES:**
918
919The following is an example of how to use ``setenv``:
920
921.. code:: shell
922
923    SHLL [/] $ setenv BASEPATH /mnt/hda1
924
925**CONFIGURATION:**
926
927.. index:: CONFIGURE_SHELL_NO_COMMAND_SETENV
928.. index:: CONFIGURE_SHELL_COMMAND_SETENV
929
930This command is included in the default shell command set.  When building a
931custom command set, define ``CONFIGURE_SHELL_COMMAND_SETENV`` to have this
932command included.
933
934This command can be excluded from the shell command set by defining
935``CONFIGURE_SHELL_NO_COMMAND_SETENV`` when all shell commands have been
936configured.
937
938**PROGRAMMING INFORMATION:**
939
940.. index:: rtems_shell_rtems_main_setenv
941
942The ``setenv`` is implemented by a C language function which has the following
943prototype:
944
945.. code:: c
946
947    int rtems_shell_rtems_main_setenv(
948        int    argc,
949        char **argv
950    );
951
952The configuration structure for the ``setenv`` has the following prototype:
953
954.. code:: c
955
956    extern rtems_shell_cmd_t rtems_shell_SETENV_Command;
957
958unsetenv - unset environment variable
959-------------------------------------
960.. index:: unsetenv
961
962**SYNOPSYS:**
963
964.. code:: shell
965
966    unsetenv variable
967
968**DESCRIPTION:**
969
970This command is remove to a ``variable`` from the set of environment variables.
971
972**EXIT STATUS:**
973
974This command will return 1 and print a diagnostic message if a failure occurs.
975
976**NOTES:**
977
978The entire RTEMS application shares a single set of environment variables.
979
980**EXAMPLES:**
981
982The following is an example of how to use ``unsetenv``:
983
984.. code:: shell
985
986    SHLL [/] $ unsetenv BASEPATH
987
988**CONFIGURATION:**
989
990.. index:: CONFIGURE_SHELL_NO_COMMAND_UNSETENV
991.. index:: CONFIGURE_SHELL_COMMAND_UNSETENV
992
993This command is included in the default shell command set.  When building a
994custom command set, define ``CONFIGURE_SHELL_COMMAND_UNSETENV`` to have this
995command included.
996
997This command can be excluded from the shell command set by defining
998``CONFIGURE_SHELL_NO_COMMAND_UNSETENV`` when all shell commands have been
999configured.
1000
1001**PROGRAMMING INFORMATION:**
1002
1003.. index:: rtems_shell_rtems_main_unsetenv
1004
1005The ``unsetenv`` is implemented by a C language function which has the
1006following prototype:
1007
1008.. code:: c
1009
1010    int rtems_shell_rtems_main_unsetenv(
1011        int    argc,
1012        char **argv
1013    );
1014
1015The configuration structure for the ``unsetenv`` has the following prototype:
1016
1017.. code:: c
1018
1019    extern rtems_shell_cmd_t rtems_shell_UNSETENV_Command;
1020
1021time - time command execution
1022-----------------------------
1023.. index:: time
1024
1025**SYNOPSYS:**
1026
1027.. code:: c
1028
1029    time command [argument ...]
1030
1031**DESCRIPTION:**
1032
1033The time command executes and times a command.  After the command finishes,
1034time writes the total time elapsed.  Times are reported in seconds.
1035
1036**EXIT STATUS:**
1037
1038This command returns 0 on success and non-zero if an error is encountered.
1039
1040**NOTES:**
1041
1042None.
1043
1044**EXAMPLES:**
1045
1046The following is an example of how to use ``time``:
1047
1048.. code:: shell
1049
1050    SHLL [/] $ time cp -r /nfs/directory /c
1051
1052**CONFIGURATION:**
1053
1054.. index:: CONFIGURE_SHELL_NO_COMMAND_TIME
1055.. index:: CONFIGURE_SHELL_COMMAND_TIME
1056
1057This command is included in the default shell command set.  When building a
1058custom command set, define ``CONFIGURE_SHELL_COMMAND_TIME`` to have this command
1059included.
1060
1061This command can be excluded from the shell command set by defining
1062``CONFIGURE_SHELL_NO_COMMAND_TIME`` when all shell commands have been
1063configured.
1064
1065**PROGRAMMING INFORMATION:**
1066
1067.. index:: rtems_shell_rtems_main_time
1068
1069The ``time`` is implemented by a C language function which has the following
1070prototype:
1071
1072.. code:: c
1073
1074    int rtems_shell_rtems_main_time(
1075        int    argc,
1076        char **argv
1077    );
1078
1079The configuration structure for the ``time`` has the following prototype:
1080
1081.. code:: c
1082
1083    extern rtems_shell_cmd_t rtems_shell_TIME_Command;
1084
1085logoff - logoff from the system
1086-------------------------------
1087.. index:: logoff
1088
1089**SYNOPSYS:**
1090
1091.. code:: shell
1092
1093    logoff
1094
1095**DESCRIPTION:**
1096
1097This command logs the user out of the shell.
1098
1099**EXIT STATUS:**
1100
1101This command does not return.
1102
1103**NOTES:**
1104
1105The system behavior when the shell is exited depends upon how the shell was
1106initiated.  The typical behavior is that a login prompt will be displayed for
1107the next login attempt or that the connection will be dropped by the RTEMS
1108system.
1109
1110**EXAMPLES:**
1111
1112The following is an example of how to use ``logoff``:
1113
1114.. code:: shell
1115
1116    SHLL [/] $ logoff
1117    logoff from the system...
1118
1119**CONFIGURATION:**
1120
1121.. index:: CONFIGURE_SHELL_NO_COMMAND_LOGOFF
1122.. index:: CONFIGURE_SHELL_COMMAND_LOGOFF
1123
1124This command is included in the default shell command set.  When building a
1125custom command set, define ``CONFIGURE_SHELL_COMMAND_LOGOFF`` to have this
1126command included.
1127
1128This command can be excluded from the shell command set by defining
1129``CONFIGURE_SHELL_NO_COMMAND_LOGOFF`` when all shell commands have been
1130configured.
1131
1132**PROGRAMMING INFORMATION:**
1133
1134.. index:: rtems_shell_rtems_main_logoff
1135
1136The ``logoff`` is implemented by a C language function which has the following
1137prototype:
1138
1139.. code:: c
1140
1141    int rtems_shell_rtems_main_logoff(
1142        int    argc,
1143        char **argv
1144    );
1145
1146The configuration structure for the ``logoff`` has the following prototype:
1147
1148.. code:: c
1149
1150    extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command;
1151
1152rtc - RTC driver configuration
1153------------------------------
1154.. index:: rtc
1155
1156**SYNOPSYS:**
1157
1158.. code:: shell
1159
1160    rtc
1161
1162**CONFIGURATION:**
1163
1164.. index:: CONFIGURE_SHELL_NO_COMMAND_RTC
1165.. index:: CONFIGURE_SHELL_COMMAND_RTC
1166
1167This command is included in the default shell command set.  When building a
1168custom command set, define ``CONFIGURE_SHELL_COMMAND_RTC`` to have this command
1169included.
1170
1171This command can be excluded from the shell command set by defining
1172``CONFIGURE_SHELL_NO_COMMAND_RTC`` when all shell commands have been
1173configured.
1174
1175exit - exit the shell
1176---------------------
1177.. index:: exit
1178
1179**SYNOPSYS:**
1180
1181.. code:: shell
1182
1183    exit
1184
1185**DESCRIPTION:**
1186
1187This command causes the shell interpreter to ``exit``.
1188
1189**EXIT STATUS:**
1190
1191This command does not return.
1192
1193**NOTES:**
1194
1195In contrast to `logoff - logoff from the system`, this command is built into
1196the shell interpreter loop.
1197
1198**EXAMPLES:**
1199
1200The following is an example of how to use ``exit``:
1201
1202.. code:: shell
1203
1204    SHLL [/] $ exit
1205    Shell exiting
1206
1207**CONFIGURATION:**
1208
1209This command is always present and cannot be disabled.
1210
1211**PROGRAMMING INFORMATION:**
1212
1213The ``exit`` is implemented directly in the shell interpreter.  There is no C
1214routine associated with it.
Note: See TracBrowser for help on using the repository browser.