Shell Script and BASH Script Flashcards
- What is a superblock in shell scripting?
A superblock is a program containing specific file systems’ records. The characteristics available in the block are size, counts of filled and empty blocks, usage information, size of block groups, and location and size of inode tables.
What do you understand by a shell?
Shell is a command-line interpreter that translates user-entered commands into kernel understandable language. The shell interprets the command typed in at the terminal and calls the required program.
Name commonly used shells on a typical Linux system.
There are mainly two kinds of Linux shells- C-shell and Bourne shell. Their derivatives are as follows:
C-shell: TENEX C-Shell, Z-Shell
Bourne shell: Korn Shell, POSIX Shell, Bourne-Again Shell
Tell about the four stages of the Linux Process.
The four stages include:
Waiting- The Linux process is waiting for the resource
Running- The Linux process is currently running
Stopped- The Linux process has been stopped after successful execution
Zombie- The Linux process is still active in the process table, but it has stopped.
Give the purpose of the shebang line.
The shebang line is at the top of each script used to determine the engine’s location and is used to execute the script.
What is the alternative command for echo?
The alternative command for echo is tput. This command allows us to control how the output is displayed on the screen.
What is a metacharacter?
Metacharacter is a unique character included in a program or data field of a shell. It offers information about other characters. For example: to list all files beginning with character ‘s,’ use the ‘ls s*’ command.
Name standard streams in Linux.
The standard streams in Linux are Standard Input, Standard Output, and Standard Error.
Tell us about the disadvantages of shell scripting.
The process is slow initially and improves gradually
Portability is not easy
Typing errors can partition as well as delete entire data
Weak designs can prove to be costly and can destroy the whole process.
What is the lifespan of a shell variable?
A variable is inside the shell script only until the end of execution.
Explain Crontab.
Crontab means cron table because the tasks are executed using the job scheduler ‘cron.’ It is a list of commands that run on a regular schedule, and the name of the command also manages the list. Crontab is the schedule and also the name of the program used to edit the schedule.
Tell us how you can compare strings in a shell script.
To compare the text strings, we use the ‘test’ command. This command compares text strings by comparing each character of each string.
When the script is running in the UNIX, can you pass arguments to it?
Yes, arguments can be passed, and it is a commonly followed practice. It is carried out to ensure the system does not have an error in executing commands and scripts run smoothly.
What is shell script?
A shell script is a command containing text file that contains one or more commands.
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.