Wikihack
Register
Advertisement

In game, the ! key triggers the shell escape. This should send you to a command line; exit the shell to return to NetHack. The exact behavior varies by operating system.

It only works if the person who compiled the game had SHELL defined in config.h. Persons who build the game for public servers or other environments in which the player should not reach a shell will disable it.

In the source code, the dosh function handles this. The code for this function, if any, is somewhere under the nethack-3.4.3/sys directory for your operating system.

The file nethack-3.4.3/sys/unix/unixunix.c contains the source for shell-escaping for a Unix system. If there is a SHELL environment variable, then NetHack will start that program, else NetHack will attempt to run /bin/sh. In most shells, the exit command will then return you to NetHack. Since most Unix now have job control, you could just press Ctrl +  Z to suspend NetHack and return to the calling shell instead of starting a subshell; for that reason some players may never think to use the shell escape.

Advertisement