GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Operating System  >  Unix Commands
Go To First  |  Previous Question  |  Next Question 
 Unix Commands  |  Question 23 of 74    Print  
Explain the steps that a shell follows while processing a command?
After the command line is terminated by the key, the shel goes ahead  with processing the command line in one or more passes. The sequence is well defined and assumes the following order.
Parsing: The shell first breaks up the command line into words, using spaces and the delimiters, unless quoted. All consecutive occurrences of a space or tab are replaced here with a single space.
Variable evaluation:  All words preceded by a $ are avaluated as variables, unless quoted or escaped.
Command substitution:  Any command surrounded by backquotes is executed by the shell which then replaces the standard output of the command into the command line.
Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *, ?, [, ]). Any word containing a wild-card is replaced by a sorted list of filenames that match the pattern. The list of these filenames then forms the arguments to the command.
PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to search in order to hunt for the command.



  
Total Answers and Comments: 1 Last Update: February 21, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 21, 2006 08:23:27   
athotaashok Member Since: December 2005   Contribution: 3    

RE: Explain the steps that a shell follows while ...
when processing a command the searchs for the utility for the command in the directories specified in the PATH varible and it in invokes that utility. That utility will execute the command with help of kernel and the output is given to shell. And then the displays out put to the user.
 
Is this answer useful? Yes | No

 Related Questions

There are four possible results from this call:‘kill()’ returns 0. This implies that a process exists with the given PID, and the system would allow you to send signals to it. It is system-dependent 
Latest Answer : Kill is one of the command in UNIX/LINux which allow user to kill/terminate one process ID or multiple processes IDs.Syntax:$kill -[options] PID$kill -9 754425The kill command send the specified signal to the specified process or process group ...

A pipe is two or more commands separated by pipe char '|'. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command. Example : ls 
Latest Answer : The Unix commands alone are powerful, but when two or more commands get combine together, we can accomplish complex task with ease.In unix we can combine the two or more commands together to perform multiple action simulatenously with the help of Pipe ...

With the help of kill command we can terminate the process.Syntax: kill pidKill 0 - kills all processes in your system except the login shell. 
Latest Answer : kill -0 : All processes in the current process group are signaled. Kill -0 commnd is use to sends signal to all process and group of process. ...

Shell variables are special variables, a name-value pair created and maintained by the shell. Example: PATH, HOME, MAIL and TERM 
Latest Answer : these are some more variables    .......$PWD,  $DIR_COLORS,  $SHELL,  $SHLVL ...

Use ‘su’ command. The system asks for password and when valid entry is made the user gains super user (admin) privileges. 
Latest Answer : "su" is the command to switch to a super user status (commonly known as root user) from a user shell.This command does not load the shell settings for a typical super user that login from a login screen. Therefore, environment variables/settings ...

Yes, it stands for ‘disk usage’. With the help of this command you can find the disk capacity and free space of the disk. 
Latest Answer : Thats right.. du gives you "disk used" and not free disk space. some of the options for du are : du -k   : returns the disk usage in KBsdu -k : gives the disk usage by direcotry and all its sub-directories in KBs ...

ls stands for list; so it displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1, chapter2, and so on. 
Latest Answer : ls -x displays the list of contents in linewise instead of column wise ...

Yes, using the ‘mesg’ command. 
Latest Answer : messages can be restricted by you with the help of 'mesg n', this will restrict the incoming of messages to your terminal, for again allowing messages for your terminal you can use 'mesg y'. ...

$ echo *It is similar to 'ls' command and displays all the files in the currentdirectory. 
Latest Answer : Ya u r correct, $echo *  will give u the files in the current directory similar to ls command. ...

$od -cbd file_namec - character, b - binary (octal), d-decimal, od=Octal Dump. 
Latest Answer : to change the output in binery format the command is :%!xxd -b ...


 Sponsored Links

 
Related Articles

Moving All the XML Processing into the Database

Moving All the XML Processing into the Database In the preceding example the database server performs only a part of the XML processing while the rest is still performed by the PHP engine Specifically the database server generates an employees XML document based on the records from the hr employees
 

Performing XML Processing inside the Database

Performing XML Processing inside the Database When building XML enabled applications on top of Oracle there are many advantages to performing the XML processing inside the database when compared to performing it on the client The key advantages to perform XML processing inside the database are as fo
 

Transforming and Processing XML with XSLT

Transforming and Processing XML with XSLT In the preceding example you transform XML into HTML directly in your script wrapping the data extracted from the XML document into appropriate HTML tags Alternatively you might perform an XSL Extensible Stylesheet Language transformation to get the same gen
 

XML Processing in PHP and Oracle Applications

Processing XML in PHP Oracle Applications As mentioned there are two alternatives when it comes to performing XML processing in your PHP Oracle application You can perform any required XML processing using either PHP s XML extensions or PEAR XML packages or Oracle s XML features mosgoogle In the fol
 

On-Line Transaction Processing

On-Line Transaction Processing On-Line Transaction Processing is a processing that supports the daily business operations. Also know as operational processing and OLTP.  An OLTP is a database which must typically allow the real-time processing of SQL transactions to support traditional reta
 

On-Line Analytical Processing

On-Line Analytical Processing On-Line Analytical Processing is a processing that supports the analysis of business trends and projections. It is also known as decision support processing and OLAP.  An OLAP software enables companies to have real-time analysis of data stored in a database. A
 

What is the use of truncate command?

Truncate command will delete all records and the most important thing to make note of truncate command is since truncate command cannot be rolled back one must make sure to take proper backup of table data before performing the truncate command. Truncate command is thus used to remove all rows from
 

How to call C header that is not provided generally by system in C++?

Headers can be called by using extern C Syntax of extern C is: extern "C" <function declaration> for example to call C functions from C++ we can write extern "C" { <function declaration> <function declaration> ...
 

How to define command line arguments

The main functions can have arguments passed which are called as command line arguments. There are two command line arguments: Argument count denoted by argc and Argument vector denoted by argv The argc is an integer variable which denotes the number of parameters passed and argv is pointer to a
 

Explain about TNSPING

You can also use tnsping utility on command prompt to check Oracle Net connectivity. Follow these steps to check the connection to particular SID. Open Command prompt. Write tnsping < SID for the database connectivity you want to check > If you get the message “Used TNSNAMES
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape