Home / Interview / Shell Script :: General Questions

Interview :: Shell Script

1) What is shell script?

A shell script is a command containing text file that contains one or more commands.

2) Why is the use of shell script?

It is used by system administrators to issue numbers of commands to accomplish the task. All commands are added together in a text file (shell script) to complete daily routine tasks.

3) What are the advantages of shell scripting?

These are the two main advantages of shell scripting:

• It facilitates you to develop your own operating system with relevant features best suited for you.
• You can design software applications according to their platform.
4) What are the disadvantages of shell scripting?

Following are the main disadvantages of shell scripting:

• A weak design can destroy the entire process and could prove a costly error.
• If a typing error occurs during the creation then it can delete the entire data as well as partition data.
• Its initial process is slow and improves gradually.
• Portability between different operating system is difficult.
5) What are the different types of variables used in shell script?

There are two types of variables used in shell script:

• System defined variables: These variables are defined or created by operating system itself.
• User defined variables: These variables are defined by system users.
6) What is the syntax of "nested if statement" in shell scripting?
7) What is the use of "$?" sign in shell script? While writing the shell script, the "$?" sign is used with "if statement" to check whether the previous command is executed successfully or not.

8) What is the use of break command?

The break command is used to escape from a loop in progress.

9) What is GUI scripting?

GUI stands for Graphical User Interface. It is used for controlling a computer and its applications. GUI scripting supports different applications. It mostly depends on the operating system.

10) What are the various stages of a Linux process it passes through?

A Linux process generally passes through four stages:

1. Waiting: In this stage, the Linux process waits for resource.
2. Running: In this stage, the Linux process is currently being executed.
3. Stopped: In this stage, the Linux process is stopped after successful execution.
4. Zombie: This stage is known as zombie because the process has stopped but still active in process table.