Adarsh Babu Kalepalli | 07fad88 | 2021-06-11 19:45:11 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | askenv command |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 4 | ============== |
Adarsh Babu Kalepalli | 07fad88 | 2021-06-11 19:45:11 +0530 | [diff] [blame] | 5 | |
| 6 | Synopsis |
| 7 | -------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | askenv name [message] [size] |
| 12 | |
| 13 | Description |
| 14 | ----------- |
| 15 | |
| 16 | Display message and get environment variable name of max size characters |
| 17 | from stdin. |
| 18 | |
Patrick Delaunay | aa5f43a | 2022-04-14 19:07:05 +0200 | [diff] [blame] | 19 | See also *env ask* in :doc:`env`. |
| 20 | |
Adarsh Babu Kalepalli | 07fad88 | 2021-06-11 19:45:11 +0530 | [diff] [blame] | 21 | name |
| 22 | name of the environment variable |
| 23 | |
| 24 | message |
| 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 | |
| 29 | size |
| 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 | |
| 35 | Example |
| 36 | ------- |
| 37 | |
| 38 | Value 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 | |
| 48 | Value 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 | |
| 58 | Value 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 | |
| 68 | Return 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 | |
| 80 | Configuration |
| 81 | ------------- |
| 82 | |
| 83 | The askenv command is only available if CMD_ASKENV=y |
| 84 | |
| 85 | Return value |
| 86 | ------------ |
| 87 | |
| 88 | The return value $? is set to 0 (true). |
| 89 | If no other arguments are specified (along with askenv), it is set to 1 (false). |