Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: exec Date: Fri, 28 Sep 2018 08:28:19 -0400 Lines: 32 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1538137711 20263 208.118.235.17 (28 Sep 2018 12:28:31 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Francis Gathea Envelope-to: bug-bash@gnu.org Mail-Followup-To: Francis Gathea , bug-bash@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14678 On Fri, Sep 28, 2018 at 09:11:26AM +0300, Francis Gathea wrote: > Same thing in a shell script. > > On 28/09/2018, Francis Gathea wrote: > > Hi. Why is this function closing out my session if typed on the terminal? > > First, please do not "top-quote". When you resond, put your response UNDER the original text, not ABOVE it. This isn't a Microsoft Windows mailing list. Second, this is what the exec command is designed to do. wooledg:~$ help exec exec: exec [-cl] [-a name] [command [arguments ...]] [redirection ...] Replace the shell with the given command. Execute COMMAND, replacing this shell with the specified program. ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified, any redirections take effect in the current shell. Options: -a name pass NAME as the zeroth argument to COMMAND -c execute COMMAND with an empty environment -l place a dash in the zeroth argument to COMMAND If the command cannot be executed, a non-interactive shell exits, unless the shell option `execfail' is set. Exit Status: Returns success unless COMMAND is not found or a redirection error occurs.