The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Script Dependencies other process pankajkrmishra Shell Programming and Scripting 4 07-25-2006 06:20 AM
How to ristrict tar to span multi volume of 1.95 gig each. interim05 AIX 0 06-19-2006 01:36 PM
span of variable ttshell Shell Programming and Scripting 3 01-24-2006 02:16 PM
Will cpio span tapes ? fidodido Shell Programming and Scripting 2 01-11-2006 08:42 AM
shell programming for process? robocup Shell Programming and Scripting 1 07-30-2005 09:35 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-16-2006
compbug compbug is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 26
process Span by shell

is it possible to find which commnands make shell to Span a child process?

if so what is the determining criteria??

thanks
  #2 (permalink)  
Old 06-16-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,794
This is a little more complicated than a post can deal with very well.
Let's use the Korn shell -- /bin/ksh as an example.

When you have in your script:

Code:
 echo "hi there"

The "echo" is a command. Most commands invoke external programs. When a command runs as a program it creates a separate process - "spawn".

Not all commands are separate processes. The type command in ksh will tell you what the command is - whehter it is a shell builtin, an external program, etc.

Code:
vcspnm:/home/jmcnama> type echo
echo is a shell builtin

vcspnm:/home/jmcnama> type ls
ls is a tracked alias for /usr/bin/ls

vcspnm:/home/jmcnama> type while
while is a keyword

vcspnm:/home/jmcnama> type lp
lp is /usr/bin/lp

So: lp and ls are programs, while and echo are part of the shell.

If type tells you it is a builtin then no separate process is created. Same for a keyword like while or if.

The flip side of this is that you can force the shell to make a separate process:

Code:
echo "stuff " > somefile &
wait

This forces command to run in a separate process, even if it would normally not do so.
  #3 (permalink)  
Old 06-17-2006
compbug compbug is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 26
thanks

thank you man

you mean commnads are programs which will be "excecuted" upon invoking them

so these programs must be the "Source code" which will be compiled and executed just like any other user progrmas when the commnad is invoked.

if I am wrong I seek your advice.
  #4 (permalink)  
Old 06-17-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,794
No. ls is a command - it points to an already compiled ready-to-run program /usr/bin/ls In order to run the ls program the shell creates a separate process.

Not all commands are separate programs. The type command tells you what flavor each command is - knowing that you then know if the command will make a separate process or not.
  #5 (permalink)  
Old 06-18-2006
compbug compbug is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 26
yeah

I got it Man thanks for your time.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0