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