Choose a topic to test your knowledge and improve your Shell Scripting skills
The UNIX shell is both _______ and _______ language.
Which of the following function(s) are performed by an interactive shell?
Every feature used in an interactive shell can also be used by a shell script.
Which one of the following is arguably the best shell to use?
Which one of the following command is used to create a child shell?
Shell variables are of ____ types.
Suppose ABD_DIR is a local variable. Then it will be accessible to the child process.
____ command is used to display the environment variables only.
____ command displays all the variables available in the current shell.
Environment variable names can be defined only in uppercase.
Environment variables control the behavior of the system.
The shell has ____ prompts.
Which one of the following command will change our primary prompt from $ to C>?
Which environment variable is used to display our username?
Which one of the following is not an environment variable?
Which symbol is used for setting the PS1 prompt to show the current event number?
Which escape sequence is used with PS1 to show the hostname of our computer?
Which of the following shells support the use of aliases?
We can display an alias definition by using an alias with the name.
Which command is used in bash and Korn shells to display the previously used commands?
To display the last five used commands, which one of the following commands is used (in bash shell)?
Which of the following symbols are used for accessing previous commands by event numbers?
We can use relative addressing while executing previous commands.
We can also execute previous commands by context.
Which symbol is used as a shorthand for using the last argument to the previous command?
Shell enables one or more arguments to be obtained from the standard output of another command. This feature is called _____
Which of the following meta-character is used in command substitution?
Command substitution is enabled in single quotes also.
POSIX recommends the use of ____ instead of archaic `command ` for command substitution.
Which of the following shell doesnβt support the command substitution using $ recommended by POSIX?
Which symbol is used for assigning a value to variables?
Which symbol is used for evaluation of variables?
Which of the following is a correct initialization of variables to null strings?
A variable can be removed using _____
readonly command is used to protect a variable from reassignment.
C shell uses which command for assigning values to variables?
The variable assignment as x = 10 (whitespace on both sides of =) will work if we are not using C shell?
What will the result when we evaluate this statement? $ directory=βpwdβ=`pwd`
Which of the following is not a system defined variable?
Which of the following is an invalid variable?
Command substitution requires the command to use _____
The command is valid. $ ls -lRa $HOME > home.ls
Which command runs the shell built-in command βcommandβ with the given argument?
Which option of the command βcdβ use the actual filesystem path for cd.. and the value of pwd?
Which command generates possible completions for string according to the and write it to standard output?
After running this program, as your press 4, what will be the output of the program? #!/bin/bash echo "How many times you want to print 'Sanfoundry'" read value for ((i=0;i<$value;i++)) do echo "Sanfoundry"; done exit 0
What is the output of this program? #!/bin/bash for i in 2 3 7 do echo "Sanfoundry" done exit 0
How can you come out of the loop in this program? #!/bin/bash read x while [ $x != "hello" ] do echo "Try to come out of the loop" read x done echo "Welcome" exit 0
What is the output of this program? #!/bin/bash echo "Which file do you want to check" read x until [ -e $x ] do echo "The file does not exist. Do you want to create? y/n" read a if [ $a = y ]; then touch $x echo "Your file has been created successfully." fi done echo "The file is present in this directory" exit 0
After running this program, if you enter 1000, then what will be the output of the program? #!/bin/bash echo "Please enter a number" read a if [ $a -lt 100 ]; then echo "It is less than 100"; elif [ $a -lt 1000 ]; then echo "It is less than 1000" else echo "It is greater than 1000" fi exit 0
Functions improves the shellβs programmability significantly, because
What is the output of this program? #!/bin/sh san_function() { echo "Welcome to the Sanfoundry" printf "World of Linux " } unset -f san_function san_function exit 0
What is the output of this program? #!/bin/sh echo "Just call the function" san_function san_function() { echo "This is a function" } exit 0
What is the output of this program? #!/bin/sh san_function1() { a=5 echo "This is the first function" san_function2 } san_function2() { echo "This is the second function" san_function3 } san_function3() { echo "This is the third function" } san_function1 exit 0
The user bhojas logged in and performed the following sequence of command. What will be the output of the last command? $ cd project/module1 $ pwd