LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-27-2012, 02:40 PM   #1
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
exec command help


Can somebody please help me in understanding the "exec" command.

How we can use it with file descriptors 0,1,2

an example will be a great help
 
Old 10-27-2012, 03:06 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,319

Rep: Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470
Quote:
Originally Posted by vicky007aggrwal View Post
Can somebody please help me in understanding the "exec" command. How we can use it with file descriptors 0,1,2
an example will be a great help
Type in "man exec", and you'll see examples and explanations. Google has much also. Without knowing what you've already looked at or what you're confused about, it's hard to help.

http://www.linuxtopia.org/online_boo...de/x13082.html
 
Old 10-27-2012, 03:25 PM   #3
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks TBone for responding,,
Just want to ask that is it necessary to assign
File descriptor before redirecting the standard input or output

Eg ; exec 6> &1
exec >output.log

As per above example even without assiging
File descriptor we can use the second command
Directly. I want to know why is it needed to use
FileDescriptor in exec
 
Old 10-27-2012, 04:32 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,319

Rep: Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470
Quote:
Originally Posted by vicky007aggrwal View Post
Thanks TBone for responding,,
Just want to ask that is it necessary to assign File descriptor before redirecting the standard input or output

Eg ; exec 6> &1
exec >output.log

As per above example even without assiging File descriptor we can use the second command Directly. I want to know why is it needed to use FileDescriptor in exec
Which is a different question than what you posted initially. Again, putting "why do you need to use file descriptor in exec linux" into Google pulls up lots...and that's a good start for any question. In this instance, you find this:
http://www.refining-linux.org/archiv...e-descriptors/

...a tutorial, with examples.
 
Old 10-28-2012, 08:49 AM   #5
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks TBone
 
  


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
exec command travix Linux - Newbie 2 09-15-2012 01:59 PM
perl using exec command ab52 Programming 3 08-15-2012 03:15 AM
find command with exec cola Linux - Newbie 5 06-01-2010 02:25 PM
exec command not working suruchi Linux - Software 2 06-12-2006 02:02 AM
exec bash command bendeco13 Linux - General 6 10-31-2004 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:19 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