Shell Scripting Interview Questions & Answers part 2


Q: – What are the two files used by the shell to initialize itself?


Q: – 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.

Q: – 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.

Q: – What is the advantage of function overloading according to users point of view?

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.

Q: – What is environment variable?

An environment variable is a variable that is available to any child process of the shell. Some programs need environment variables in order to function correctly. Usually a shell script defines only those environment variables that are needed by the programs that it runs.

Q: – What is shell variable?

A shell variable is a special variable that is set by the shell and is required by the shell in order to function correctly. Some of these variables are environment variables whereas others are local variables.

Q: – Explain the “Exit” command?

Every program whether on UNIX or Linux should end at a certain point of time and successful completion of a program is denoted by the output 0. If the program gives an output other than 0 it defines that there has been some problem with the execution or termination of the problem. Whenever you are calling other function, exit command gets displayed.

Q: – How do you find out what’s your shell?

echo $SHELL

Q: – How you will run a process in the background?

./ProcessName &

Submitted By:-Naveen Kumar            Email-ID: –