Forrest logo
back to the ${!-n}:p tool

histexpand:tldr:b9efd

histexpand: Perform a history expansion, but print the command that would be run instead of actually running it.
$ ${!-n}:p
try on your machine

This command uses a syntax known as history expansion in UNIX-like systems, including Linux and macOS. Specifically, ${!-n}:p refers to a special parameter expansion used to access previous command line arguments or commands.

Breaking down each component:

  • ${!-n}: The ! character is used to reference a command in history. !-n refers to the value of the nth command line argument from the previous command.
  • :p: The :p modifier is used to print the resulting value on the command line.

Overall, the command ${!-n}:p allows you to retrieve and display the value of the nth previous command line argument.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ${!-n}:p tool