printenv.rst 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. printenv command
  3. ================
  4. Synopsis
  5. --------
  6. ::
  7. printenv [-a] [name ...]
  8. printenv -e [-guid guid][-n] [name]
  9. Description
  10. -----------
  11. The printenv command is used to print environment or UEFI variables.
  12. \-a
  13. Print environment variables starting with a period ('.').
  14. \-e
  15. Print UEFI variables. Without -e environment variables are printed.
  16. \-guid *guid*
  17. Specify vendor GUID *guid*. If none is specified, all UEFI variables with
  18. the specified name are printed irrespective of their vendor GUID.
  19. \-n
  20. don't show hexadecimal dump of value
  21. name
  22. Variable name. If no name is provided, all variables are printed.
  23. Multiple environment variable names may be specified.
  24. Examples
  25. --------
  26. The following examples demonstrates the effect of the *-a* flag when displaying
  27. environment variables:
  28. ::
  29. => setenv .foo bar
  30. => printenv
  31. arch=sandbox
  32. baudrate=115200
  33. board=sandbox
  34. ...
  35. stdout=serial,vidconsole
  36. Environment size: 644/8188 bytes
  37. => printenv -a
  38. .foo=bar
  39. arch=sandbox
  40. baudrate=115200
  41. board=sandbox
  42. ...
  43. stdout=serial,vidconsole
  44. Environment size: 653/8188 bytes
  45. =>
  46. The next example shows the effect of the *-n* flag when displaying an UEFI
  47. variable and how to specify a vendor GUID:
  48. ::
  49. => printenv -e -guid 8be4df61-93ca-11d2-aa0d-00e098032b8c PlatformLangCodes
  50. PlatformLangCodes:
  51. 8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
  52. BS|RT|RO, DataSize = 0x6
  53. 00000000: 65 6e 2d 55 53 00 en-US.
  54. => printenv -e -n PlatformLangCodes
  55. PlatformLangCodes:
  56. 8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
  57. BS|RT|RO, DataSize = 0x6
  58. =>
  59. Configuration
  60. -------------
  61. UEFI variables are only supported if CONFIG_CMD_NVEDIT_EFI=y. The value of UEFI
  62. variables can only be displayed if CONFIG_HEXDUMP=y.
  63. Return value
  64. ------------
  65. The return value $? is 1 (false) if a specified variable is not found.
  66. Otherwise $? is set to 0 (true).