blob: 347bd5945832e24b850caf4c7acf43e02ca7ed33 [file] [log] [blame]
Adarsh Babu Kalepalli07fad882021-06-11 19:45:11 +05301.. SPDX-License-Identifier: GPL-2.0+:
2
3askenv command
4===============
5
6Synopsis
7--------
8
9::
10
11 askenv name [message] [size]
12
13Description
14-----------
15
16Display message and get environment variable name of max size characters
17from stdin.
18
Patrick Delaunayaa5f43a2022-04-14 19:07:05 +020019See also *env ask* in :doc:`env`.
20
Adarsh Babu Kalepalli07fad882021-06-11 19:45:11 +053021name
22 name of the environment variable
23
24message
25 message is displayed while the command waits for the value to be
26 entered from stdin.if no message is specified,a default message
27 "Please enter name:" will be displayed.
28
29size
30 maximum number of characters that will be stored in environment
31 variable name.this is in decimal number format (unlike in
32 other commands where size values are in hexa-decimal). Default
33 value of size is 1023 (CONFIG_SYS_CBSIZE - 1).
34
35Example
36-------
37
38Value of a environment variable env1 without message and size parameters:
39
40::
41
42 => askenv env1;echo $?
43 Please enter 'env1': val1
44 0
45 => printenv env1
46 env1=val1
47
48Value of a environment variable env2 with message and size parameters:
49
50::
51
52 => askenv env2 Please type-in a value for env2: 10;echo $?
53 Please type-in a value for env2: 1234567890123
54 0
55 => printenv env2
56 env2=1234567890
57
58Value of a environment variable env3 with size parameter only:
59
60::
61
62 => askenv env3 10;echo $?
63 Please enter 'env3': val3
64 0
65 => printenv env3
66 env3=val3
67
68Return Value of askenv command, when used without any other arguments:
69
70::
71
72 => askenv;echo $?
73 askenv - get environment variables from stdin
74
75 Usage:
76 askenv name [message] [size]
77 - display 'message' and get environment variable 'name' from stdin (max 'size' chars)
78 1
79
80Configuration
81-------------
82
83The askenv command is only available if CMD_ASKENV=y
84
85Return value
86------------
87
88The return value $? is set to 0 (true).
89If no other arguments are specified (along with askenv), it is set to 1 (false).