~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 347bd5945832e24b850caf4c7acf43e02ca7ed33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.. SPDX-License-Identifier: GPL-2.0+:

askenv command
===============

Synopsis
--------

::

    askenv name [message] [size]

Description
-----------

Display message and get environment variable name of max size characters
from stdin.

See also *env ask* in :doc:`env`.

name
    name of the environment variable

message
    message is displayed while the command waits for the  value to be
    entered from stdin.if no message is specified,a default message
    "Please enter name:" will be displayed.

size
    maximum number of characters that will be stored in environment
    variable name.this is in decimal number format (unlike in
    other commands where size values are in hexa-decimal). Default
    value of size is 1023 (CONFIG_SYS_CBSIZE - 1).

Example
-------

Value of a environment variable env1 without message and size parameters:

::

    => askenv env1;echo $?
    Please enter 'env1': val1
    0
    => printenv env1
    env1=val1

Value of a environment variable env2 with message and size parameters:

::

    => askenv env2 Please type-in a value for env2: 10;echo $?
    Please type-in a value for env2: 1234567890123
    0
    => printenv env2
    env2=1234567890

Value of a environment variable env3 with size parameter only:

::

    => askenv env3 10;echo $?
    Please enter 'env3': val3
    0
    => printenv env3
    env3=val3

Return Value of askenv command, when used without any other arguments:

::

    => askenv;echo $?
    askenv - get environment variables from stdin

    Usage:
    askenv name [message] [size]
        - display 'message' and get environment variable 'name' from stdin (max 'size' chars)
    1

Configuration
-------------

The askenv command is only available if CMD_ASKENV=y

Return value
------------

The return value $? is set to 0 (true).
If no other arguments are specified (along with askenv), it is set to 1 (false).