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