LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2012, 01:34 PM   #1
travix
LQ Newbie
 
Registered: Jul 2012
Posts: 11

Rep: Reputation: Disabled
exec command


Why is it that when I type exec ls at the command line my terminal session ends?
 
Old 09-15-2012, 01:58 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
exec will start a new process, but the new process will be started in place of the parent (so the current process will not exist any more). When ls completed and the process finished your current terminal will also ended because the child process terminated (it was initially your shell, but you replaced it by exec)
 
Old 09-15-2012, 01:59 PM   #3
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
By design.

In bash, I presume?

Code:
help exec
Quote:
Replace the shell with the given command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl using exec command ab52 Programming 3 08-15-2012 03:15 AM
Linux exec command grob115 Programming 4 05-02-2011 07:15 AM
find command with exec cola Linux - Newbie 5 06-01-2010 02:25 PM
exec command in Launcher? annehoog Linux - Newbie 4 11-23-2006 12:08 PM
exec bash command bendeco13 Linux - General 6 10-31-2004 04:50 PM


All times are GMT -5. The time now is 01:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration