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