source: rtems-docs/shell/general_commands.rst @ 9aafb39

4.115
Last change on this file since 9aafb39 was 36def91, checked in by Joel Sherrill <joel@…>, on 10/28/16 at 00:47:07

rtems-docs: Fix many unnecessary back slashes

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