Friday 6 February 2015

advanced unix shell scripting interview questions and answers (Page 3)

Below are some important Shell Scripting interview questions which are asked in most MNC company interviews for beginners or professionals.

21. What is "Command Substitution" ?
Command substitution is the process by which the shell runs a command and replaces the command substitution with the output of the executed command. That sounds like a mouthful, but it's pretty straightforward in practice.

22. What is " eval" command ?
The eval command exists to supersede the normal command-line substitution and evaluation order, making it possible for a shell script to build up commands dynamically. This is a powerful facility, but it must be used carefully. Because the shell does so many different kinds of substitutions, it pays to understand the order in which the shell evaluates input lines.

23. What is awk ?
An awk invocation can define variables, supply the program, and name the input files.

24. What is "grep" programe ?
The grep program is the primary tool for extracting interesting lines of text from input datafiles. POSIX mandates a single version with different options to provide the behavior traditionally obtained from the three grep variants: grep, egrep, and fgrep.

25. Name a new feature introduced with PHP 5.
PHP 5 introduces (among other things) SQLite support, improved XML support, and a significantly improved object model.

26. Explain "read" command ?
The read command is one of the most important ways to get information into a shell program:
$ x=abc ; printf "x is now '%s'. Enter new value: " $x ; read x
x is now 'abc'. Enter new value: PDQ
$ echo $x
PDQ

27. What are the two files used by the shell to initialize itself?
/etc/profile
profile

28. What is Interactive mode?
Interactive mode means that the shell expects to read input from you and execute the commands that you specify. This mode is called interactive because the shell is interacting with a user. This is usually the mode of the shell that most users are familiar with: you log in, execute some commands, and log out. When you log out using the exit command, the shell exits.

29 What is noninteractive mode?
In this mode, the shell does not interact with you; instead it reads commands stored in a file and executes them. When it reaches the end of the file, the shell exits.

30. what is local variable?
A local variable is a variable that is present within the current instance of the shell. It is not available to programs that are started by the shell. The variables that you looked at previously have all been local variables.
More Questions & Answers :-

No comments:

Post a Comment