Advanced Bash Shell Scripting Quiz Questions and Answers

Answer :
  • !!

Explanation :

’!cat’ will reexecute the last cat command, ‘!3’ will reexecute the third last command and ‘!$’ will execute the last argument of previous command.
Answer :
  • env

Explanation :

env is an external command which runs in a child process and it lists only environment variables which are inherited from its parent, the shell.
Answer :
  • both find & fix command

Explanation :

’fc -l’ is used to list history of commands and ‘fc -e’ to edit them and ‘history’ command also provides the histroy of commands.
Answer :
  • set -A array_name value1 value2 ... Valuen

Explanation :

If you are using the ksh shell, here is the syntax of array initialization : set -A array_name value1 value2 ... valuen.
Answer :
  • A) numbers
    B) letters
    C) underscore
    All of the above

Explanation :

The name of a variable can contain only letters (a to z or A to Z), numbers ( 0 to 9) or the underscore character ( _).
Answer :
  • unset

Explanation :

Unsetting or deleting a variable directs the shell to remove the variable from the list of variables that it tracks.
Answer :
  • array_name=(value1 ... valuen)

Explanation :

If you are using the bash shell, here is the syntax of array initialization : array_name=(value1 ... valuen)
Answer :
  • scalar variables

Explanation :

A shell variable is capable enough to hold a single value. These variables are called scalar variables.
Answer :
  • stops the process running in the shell

Explanation :

Ctrl-Z key combination generates a SIGTSTP signal and stops the process running in the shell.
Answer :
  • ${array_name[index]}

Explanation :

After you have set any array variable, you access it as follows : ${array_name[index]}