askenv.rst 1.8 KB

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