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

5
Last change on this file since e52906b was e52906b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:06

Simplify SPDX-License-Identifier comment

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