How commands are executing ?

Smith Jack (Ext. - UGIS - UniCredit Group) jack.smith.extern at unicreditgroup.de
Tue Jul 21 12:59:37 UTC 2009


That doesn't really answer his question, though.

When you issue a command to bash (a shell), it has to find the command.  It might be a built-in (such as 'cd') or shell function (such as the result of an alias) or it may be another type of command.  If the command refers to a file, then the shell must 'peek' into the file in order to know what to do.  

In the case of many commands, the "what to do"  part is to launch the specified interpretor (normally specified immediately after the #! characters in the beginning of the file), in a sense this interpretor then becomes a shell for the list of commands specified by the file.

So called 'binary' executable files have a 'header' (read when the shell peeks into the file) which indicates to the shell that they are ready to execute without the need of an interpretor.

The shell does a lot more than that, but this topic is too huge for this forum.


> -----Original Message-----
> From: redhat-list-bounces at redhat.com 
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Geofrey Rainey
> Sent: Tuesday, July 21, 2009 2:12 PM
> To: General Red Hat Linux discussion list
> Subject: RE: How commands are executing ? 
> 
> Binary programs are just that, compiled machine language.
> 
> Perl programs aren't, they're standard ascii, the Perl 
> interpreter (/usr/bin/perl) does that part of it.
> 
> -----Original Message-----
> From: redhat-list-bounces at redhat.com 
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of siva subramaniyan
> Sent: Wednesday, 22 July 2009 12:06 a.m.
> To: redhat-list at redhat.com
> Subject: How commands are executing ? 
> 
> 
> I have a small doubt, the binary commands under /bin and 
> /sbin as well as other path binary files, if you peek deep 
> into that, you can find the difference in the way of normal 
> perl programming and some commands will be like binary files. 
> how are the commands executing like the difference in perl 
> scripting and binary files.
> 
> 
>   siva
> 
> 
> 
>       Yahoo! recommends that you upgrade to the new and safer 
> Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=subscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> ==========================================================
> For more information on the Television New Zealand Group, 
> visit us online at tvnz.co.nz 
> ==========================================================
> CAUTION:  This e-mail and any attachment(s) contain 
> information that is intended to be read only by the named 
> recipient(s).  This information is not to be used or stored 
> by any other person and/or organisation.
> 
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 




More information about the redhat-list mailing list