<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <meta name="generator" content="HTML Tidy, see www.w3.org"> <meta http-equiv="Content-Type" content= "text/html; charset=utf-8"> <title>exec - Run commands and open, close, or copy descriptors</title> <LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css"> </HEAD> <body bgcolor="#FFFFFF"> <!-- Java sync-link --> <SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT> <h2>exec - Run commands and open, close, or copy descriptors</h2> <strong>Synopsis</strong> <p> <strong>exec [ -c ] [</strong> <em>command</em> <strong>[</strong> <em>argument ...</em> <strong>] ]</strong> </p> <p><strong>Description</strong></p> <p>The <strong>exec</strong> utility replaces <strong> qsh</strong> with <em>command</em> without creating a new process. The specified <em>arguments</em> are arguments to <em> command</em>. Any redirections affect the current environment.</p> <p>When a <em>command</em> is not specified, any redirections are processed in the current environment. Any file descriptors greater than 2 that are opened by a redirection are not inherited when <strong>qsh</strong> invokes another program.</p> <p><strong>Options</strong></p> <dl> <dt> <strong>-c</strong></dt> <dd>Run <em>command</em> with an empty set of environment variables. </dd> </dl> <p><strong>Operands</strong></p> <p>Each <em>argument</em> is assigned in order to the positional parameters of <em>command</em>.</p> <p><strong>Exit Status</strong></p> <p>Zero if no <em>command</em> is specified. Otherwise it does not return to <strong>qsh</strong>.</p> <p><strong>Related information</strong></p> <ul> <li><a href="command.htm">command - Run a simple command</a></li> <li><a href="dot.htm">dot (.) - Run commands in current environment</a></li> <li><a href="eval.htm">eval - Construct command by concatenating arguments</a></li> <li><a href="nohup.htm">nohup - Run utility without hangups</a></li> <li><a href="print.htm">print - Write output</a></li> <li><a href="read.htm">read - Read a line from standard input</a></li> </ul> <strong>Examples</strong> <ol> <li>Open a file for reading on descriptor 5: <pre> exec 5<$HOME/input </pre></li> <li>Close descriptor 5: <pre> exec 5<&- </pre></li> </ol> </body> </html>