Prompt user to enter configuration setting

Synopsis

  read [--timeout <timeout>] <setting>

Examples

Prompt user to enter boot filename

  read filename

Allow user to configure an IP address for the interface "net0"

  echo -n IP address: && read net0/ip
  echo -n Subnet mask: && read net0/netmask
  echo -n Default gateway: && read net0/gateway

Allow user to edit a kernel command line before booting

  set cmdline selinux=0 console=ttyS0,115200n8 console=tty0
  echo -n Kernel command line: ${}
  read cmdline
  chain http://my.web.server/vmlinuz ${cmdline}

Description

Set value of the specified configuration setting to the value provided by the user, waiting for the specified timeout (in milliseconds). If no timeout is explicitly specified, or if a zero timeout is specified, then iPXE will wait indefinitely.

The value will be interpreted according to the type specified as part of the setting name. For example, to prompt the user to enter a configuration setting for an NTP server address (DHCP option 42):

  read 42:ipv4

If no type is explicitly specified, then the setting's default type will be used.

Command status

Success The configuration setting was applied successfully
Failure The configuration setting was not applied successfully, or no key was pressed within the timeout period

See also

Notes

You can use the config command to browse and edit settings interactively.

You can add a trailing space after a prompt string printed using the echo command by adding an empty variable ${} to the end of the prompt string. For example:

  iPXE> echo -n IP address: ${} && read net0/ip
  IP address: 192.168.0.1

You can use the login command to prompt the user to enter a user name and password (without displaying the password on-screen).

cmd/read.txt ยท Last modified: 2021/04/23 11:40 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL https://ipxe.org
References to "iPXE" may not be altered or removed.