Difference between revisions of "Shell escape"

From NetHackWiki
Jump to navigation Jump to search
(In four paragraphs, describe the shell escape, including how it does upon Unix.)
(No difference)

Revision as of 00:05, 31 August 2006

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 Unix. 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 Control-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.