Interview :: Shell Script
A shell script is a command containing text file that contains one or more commands.
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.
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.
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.
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.
While writing the shell script, the "$?" sign is used with "if statement" to check whether the previous command is executed successfully or not.
The break command is used to escape from a loop in progress.
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.
A Linux process generally passes through four stages:
- Waiting: In this stage, the Linux process waits for resource.
- Running: In this stage, the Linux process is currently being executed.
- Stopped: In this stage, the Linux process is stopped after successful execution.
- Zombie: This stage is known as zombie because the process has stopped but still active in process table.