Searching for jobs know a day has turned out to be very difficult that searching itself becomes a job. Not only preparing for the interview one must know where to apply for appropriate job. Here in Wisdomjobs to avoid such difficulty and save your precious time we have provided a complete details of interview question and answers in our site. To clear the interview, one must prepare well for the interview. There are many leading companies that offer jobs in various position UNIX Shell Scripting, Software Engineer (DataStage, Unix Shell, Java Developer with Unix Shell Scripting, Application/Production Support Engineer, Support Analyst - SQL & Unix + Unix Shell Scripting and many other roles too. To get the complete details about Unix Shell Scripting jobs, Unix Shell Scripting Interview Question and Answers and different kind of roles visit our site www.wisdomjobs.com.
Answer :
Shell is a command interpreter, which interprets the command which the user gives to the kernel. It can also be defined as an interface between a user and operating system.
Question 2. What Is Shell Scripting?
Answer :
Shell scripting is nothing but series or sequence of UNIX commands written in a plain text file. Instead of specifying one job/command at a time, in shell scripting we give a list of UNIX commands like a to-do list in a file to execute it.
Question 3. What Is The Importance Of Writing Shell Scripts?
Answer :
The points given below explain the importance of writing shell scripts.
Question 4. Shell Programs Are Stored In Which File?
Answer :
Shell programs are stored in a file called sh.
Question 5. What Are The Different Types Of Shells Available?
Answer :
There are mainly 4 important types of shells that are widely used.
And they include:
Question 6. What Are The Advantages Of C Shell Over Bourne Shell?
Answer :
The advantages of C Shell over Bourne Shell are:
Question 7. How Many Fields Are Present In A Crontab File And What Does Each Field Specify?
Answer :
The crontab file has six fields. The first five fields tell cron when to execute the command: minute(0-59), hour(0-23), day(1-31), month(1-12), and day of the week(0-6, Sunday = 0).
And the sixth field contains the command to be executed
Question 8. Is Separate Compiler Required For Executing A Shell Program?
Answer :
A separate compiler is not required to execute a shell program. The shell itself interprets the command in the shell program and executes them.
Question 9. How Many Shell Scripts Come With Unix Operating System?
Answer :
There are approximately 280 shell scripts that come with the UNIX operating system.
Question 10. When Should Shell Programming/scripting Not Be Used?
Answer :
Question 11. Basis Of Shell Program Relies On What Fact?
Answer :
The basis of shell programming relies on the fact that UNIX shell can accept commands not just only from the keyboard but also from a file.
Question 12. What Are The Default Permissions Of A File When It Is Created?
Answer :
666 i.e. rw-rw-rw- is the default permission of a file when it is created.
Question 13. What Can Be Used To Modify File Permissions?
Answer :
File permissions can be modified using umask.
Question 14. How To Accomplish Any Task Via Shell Script?
Answer :
Any task can be accomplished via shell script at the dollar ($) prompt and vice versa.
Question 15. What Are Shell Variables?
Answer :
Shell variables are the main part of shell programming or scripting. They mainly provide the ability to store and manipulate information within a shell program.
Question 16. What Are The Two Types Of Shell Variables? Explain In Brief?
Answer :
The two types of shell variables are:
1) Unix Defined Variables or System Variables – These are standard or shell defined variables. Generally, they are defined in CAPITAL letters.
Example: SHELL – This is a Unix Defined or System Variable, which defines the name of the default working shell.
2) User Defined Variables – These are defined by users. Generally, they are defined in lower letters
Example: $ a=10 –Here the user has defined a variable called ‘a’ and assigned value to it as 10.
Question 17. How Are Shell Variables Stored? Explain With A Simple Example?
Answer :
Shell variables are stored as string variables.
Example: $ a=10
In the above statement a=10, the 10 stored in ‘a’ is not treated as a number, but as a string of characters 1 and 0.
Question 18. What Is The Lifespan Of A Variable Inside A Shell Script?
Answer :
The lifespan of a variable inside shell script is only until the end of execution.
Question 19. How To Make Variables As Unchangeable?
Answer :
Variables can be made unchangeable using readonly. For instance, if we want variable a value to remain as 10 and not to be changed then we can achieve this using readonly.
Example:
$ a=10
$ readonly a
Question 20. How Variables Can Be Wiped Out?
Answer :
Variables can be wiped out or erased using the unset command.
Example:
$ a =20
$ unset a
Upon using the above command the variable ‘a’ and its value 20 get erased from shell’s memory.
CAUTION: Be careful while using this unset command.
Question 21. What Are Positional Parameters? Explain With An Example?
Answer :
Positional parameters are the variables defined by a shell. And they are used whenever we need to convey information to the program. And this can be done by specifying arguments at the command line.
There are totally 9 positional parameters present i.e. from $1 to $9.
Example: $ Test Indian IT Industry has grown very much faster
In the above statement, positional parameters are assigned like this.
$0 -> Test (Name of a shell program/script)
$1 ->Indian
$2 -> IT and so on.
Answer :
A file name which begins with a .(dot) is called as a hidden file. Whenever we try to list the files it will list all the files except hidden file.
But it will be present in the directory. And to list the hidden file we need to use –a option of ls. i.e. $ ls –a.
Question 23. What Is The Difference Between Diff And Cmp Commands?
Answer :
diff – Basically, it tells about the changes which need to be made to make files identical.
cmp – Basically it compares two files byte by byte and displays the very first mismatch.
Answer :
New file contains one link. And a new directory contains two links.
Question 25. What Is A File System?
Answer :
The file system is a collection of files which contain related information of the files.
Question 26. What Are The Three Different Security Provisions Provided By Unix For A File Or Data?
Answer :
Three different security provisions provided by UNIX for a file or data are:
Question 27. What Are The Three Editors Available In Almost All The Versions Of Unix?
Answer :
The three editors are ed, ex & vi.
Question 28. What Are The Three Modes Of Operation Of Vi Editor? Explain In Brief?
Answer :
The three modes of operation of vi editors are:
Question 29. What Is The Alternative Command Available To Echo And What Does It Do?
Answer :
tput is an alternative command to echo.
Using this, we can control the way in which the output is displayed on the screen.
Question 30. How To Find Out The Number Of Arguments Passed To The Script?
Answer :
The number of arguments passed to the script can be found as shown below.
echo $ #
Answer :
Control Instructions are the ones, which enable us to specify the order in which the various instructions in a program/script are to be executed by the computer. Basically, they determine a flow of control in a program.
There are 4 types of control instructions that are available in a shell:
Sequence Control Instruction – This ensures that the instructions are executed in the same order in which they appear in the program.
Selection or Decision Control Instruction – It allows the computer to take a decision as to which instruction is to be executed next.
Repetition or Loop Control Instruction – It helps a computer to execute a group of statements repeatedly.
Case-Control Instruction – This is used when we need to select from several alternatives.
Question 32. What Are Loops And Explain Three Different Methods Of Loops In Brief?
Answer :
Loops are the ones, which involve repeating some portion of the program/script either a specified number of times or until a particular condition is being satisfied.
3 methods of loops are:
For loop – This is the most commonly used loop. For loop allows specifying a list of values which the control variable in the loop can take. The loop is then executed for each value mentioned in the list.
While loop – This is used in a program when we want to do something for a fixed number of times. While loop gets executed till it returns a zero value.
Until loop – This is similar to while loop except that the loop executes until the condition is true. Until loop gets executed at least once till it returns a non-zero value.
Answer :
IFS stands for Internal Field Separator. And it is one of the system variables. By default, its value is space, tab, and a new line.
It signifies that in a line where one field or word ends and another begins.
Question 34. What Is A Break Statement And What Is It Used For?
Answer :
The break is a keyword and is used whenever we want to jump out of a loop instantly without waiting to get back to the control command.
When the keyword break is encountered inside any loop in the program, control will get passed automatically to the first statement after a loop. A break is generally associated with an if.
Question 35. What Is Continue Statement And What Is It Used For?
Answer :
Continue is a keyword and is used whenever we want to take the control to the beginning of the loop, by passing the statements inside the loop which have not yet been executed.
When the keyword continue is encountered inside any loop in the program, control automatically passes to the beginning of a loop. Continue is generally associated with an if.
Question 36. What Are The Two Files Of Crontab Command?
Answer :
Two files of crontab command are:
cron.allow – It decides which users need to be permitted from using crontab command.
cron.deny – It decides which users need to be prevented from using crontab command.
Question 37. What Are The Different Commands Available To Check The Disk Usage?
Answer :
There are three different commands available to check the disk usage.
And they are:
df – This command is used to check the free disk space.
du – This command is used to check the directory wise disk usage.
dfspace – This command is used to check the free disk space in terms of MB.
Question 38. What Is Shebang In A Shell Script?
Answer :
Shebang is a # sign followed by an exclamation i.e. !. Generally, this can be seen at the beginning or top of the script/program. Usually, a developer uses this to avoid repetitive work. Shebang mainly determines the location of the engine which is to be used in order to execute the script.
Here ‘#’ symbol is called as hash and ‘!’ is called a bang.
Example: #!/bin/bash
The above line also tells which shell to use.
Unix Shell Scripting Related Tutorials |
|
---|---|
Perl Scripting Tutorial | Shell Scripting Tutorial |
AWK Tutorial | Unix/Linux Tutorial |
Unix socket Tutorial | Unix makefile Tutorial |
Unix Shell Scripting Related Practice Tests |
|
---|---|
Perl Scripting Practice Tests | Shell Scripting Practice Tests |
Autosys Practice Tests |
Unix Shell Scripting Practice Test
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.