askenv.rst 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. askenv command
  3. ===============
  4. Synopsis
  5. --------
  6. ::
  7. askenv name [message] [size]
  8. Description
  9. -----------
  10. Display message and get environment variable name of max size characters
  11. from stdin.
  12. See also *env ask* in :doc:`env`.
  13. name
  14. name of the environment variable
  15. message
  16. message is displayed while the command waits for the value to be
  17. entered from stdin.if no message is specified,a default message
  18. "Please enter name:" will be displayed.
  19. size
  20. maximum number of characters that will be stored in environment
  21. variable name.this is in decimal number format (unlike in
  22. other commands where size values are in hexa-decimal). Default
  23. value of size is 1023 (CONFIG_SYS_CBSIZE - 1).
  24. Example
  25. -------
  26. Value of a environment variable env1 without message and size parameters:
  27. ::
  28. => askenv env1;echo $?
  29. Please enter 'env1': val1
  30. 0
  31. => printenv env1
  32. env1=val1
  33. Value of a environment variable env2 with message and size parameters:
  34. ::
  35. => askenv env2 Please type-in a value for env2: 10;echo $?
  36. Please type-in a value for env2: 1234567890123
  37. 0
  38. => printenv env2
  39. env2=1234567890
  40. Value of a environment variable env3 with size parameter only:
  41. ::
  42. => askenv env3 10;echo $?
  43. Please enter 'env3': val3
  44. 0
  45. => printenv env3
  46. env3=val3
  47. Return Value of askenv command, when used without any other arguments:
  48. ::
  49. => askenv;echo $?
  50. askenv - get environment variables from stdin
  51. Usage:
  52. askenv name [message] [size]
  53. - display 'message' and get environment variable 'name' from stdin (max 'size' chars)
  54. 1
  55. Configuration
  56. -------------
  57. The askenv command is only available if CMD_ASKENV=y
  58. Return value
  59. ------------
  60. The return value $? is set to 0 (true).
  61. If no other arguments are specified (along with askenv), it is set to 1 (false).