Go to main content

Oracle® Solaris Modular Debugger Guide

Exit Print View

Updated: February 2021

Shell Escapes in MDB

The ! character can be used to create a pipeline between an MDB command and the user's shell. Shell escapes are available only when using mdb and not when using kmdb. If the $SHELL environment variable is set, MDB will fork and exec this $SHELL program for shell escapes. If $SHELL is not set, /bin/sh is used. The shell is invoked with the –c option followed by a string formed by concatenating the words after the ! character.

The ! character takes precedence over all other metacharacters, except semicolon (;) and newline. After a shell escape is detected, the remaining characters up to the next semicolon or newline are passed as is to the shell. The output of shell commands cannot be piped to MDB dcmds. The output of commands executed by a shell escape is sent directly to the terminal, not to MDB.