• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/109

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

109 Cards in this Set

  • Front
  • Back

The file ".bashrc" is an example of




A secret file


A system file


A private file


A startup file


A configuration file

A startup file

If a user modifies the .bash_profile file, it can then be executed to put the changes into effect without logging out, by using the command:




bash .bash_profile


. .bash_profile


set .bash_profile


sh .bash_profile

. .bash_profile

How do double quotation marks (") differ from single quotation marks (') affect expansion on the command line?




single quotations permit variable expansion while double quotations do not.


double quotations permit variable and parameter expansion while single quotations suppress all expansions.


double quotations suppress all expansions while single quotation permit both variable and parameter expansion.


There is no difference between double and single quotations.

double quotations permit variable and parameter expansion while single quotations suppress all expansions.

Under Bash shell, the command: export CDPATH=$HOME:$HOME/MyFiles causes:




the cd command to search the HOME directory


the cd command to search the MyFiles directory (under the HOME directory)


the cd command to search the working directory


all of the above


None of the above

all of the above

BASH is an acronym for:




Bourne Shell


Born and Korn Shell


Bourne Again Shell


Dash Shell


None of the above

Bourne Again Shell

Under Bash Shell, the command: city=Los Angeles




Creates a userdefinedvariable, called city, and initializes it to Los Angeles


Creates a user-definedvariables city and initializes it to Los, and tries to execute Angeles as acommand.


Creates a user-definedvariable, called city, and initializes it to Los and creates a string variable,called Angeles and sets it to a null string.


None of the above

Creates a user-defined variables city and initializes it to Los, and tries to execute Angeles as a command.

If you are logged into the host: "COIS-Linux" what command will change the default Bash Shell prompt to: "COIS-Linux=> "




PROMPT=/host /=>


PS1=/HOST / +>


PS1="/h / => "


PS1='\h => '

PS1='\h => '

The default value of the IFS variable is:




a colon


a semicolon


a comma


None of the above.

None of the above.

When interpreting your commands, the shell assumes the first word you type on the command line is




a valid Linux command name.


an option to a command.


an option argument to the command.


a command argument to a valid command.


None of the above

a valid Linux command name.

What is the name of the root process under Linux?




root


init


parent


login

init

Why would you want to change your default shell?




To use a different programming language.


To execute applications more rapidly.


To get the different functionality of another shell.


To create more hidden files


None of the above

To get the different functionality of another shell.

Variables "name" and "place" can be made constant by:




use of the readonly command.


removing the write permission from each.


use of the set +r command.


None of the above.

use of the readonly command.

What is the difference in output between these two command:


echo The working directory is `pwd`


echo The working directory is $(pwd)




The first displays: The working directory is pwdwhile the second displays the working directory is (pwd)


In the first command pwd is expanded to display the working directory, while in the secondcommand the variable pwd is displayed.


In the second command the result of the command pwd is placed in parentheses, while in thefirst there are no parentheses.


No difference

No difference

The file: /bin/sh on a Linux system:




is a copy of the original Bourne Shell.


is a link to the Unix /etc/korn shell file.


is a link to the /bin/bash file.


None of the above

is a link to the /bin/bash file.

What is the symbol that creates a pipe between commands?




Greater than sign (>)


Less than sign (<)


Tilde (~)


Colon (:)


None of the above

None of the above

The command: find /usr -name ace -print > findout &




searches for the file: "ace"


begins the find search in the directory: "/usr"


runs the command in the background.


All of the above.

All of the above.

Which command can be used to display the value of a specific variable?




echo


cat


display


type

echo

Which of the following is an example of command substitution?




echo `pwd`


pwd=/home/user01


$command=pwd


echo "pwd"

echo `pwd`

The list of directories stored in the PATH variable is known as




the environment.


the search path.


the execution path.


the metacharacter set.


None of the above

the search path.

Under Bash shell, the environment variable HOME contains the absolute pathname of:




Your current directory


Your home directory


The root directory


All of the above


None of the above

Your home directory

What creates a process under Linux?




execution of a command utility.


running a shell script


running a shell builtin command.


All of the above


Both Answers A and B are correct.

Both Answers A and B are correct.

What command removes the variable "name" that has been created in a shell?




rm name


del name


unset name


All of the above.

unset name

A Bash shell script is:




saved in an ordinary UNIX file.


consists of shell commands.


allows the use of programming logic.


supports the use of variables.


All of the above.

All of the above.

Which of the following commands will declare file descripter 2 (stderr) to be a dupblicate of file descripter 1 (stdout) and sends both to the tr command?




cat myfile names |& tr "[a-z]""[A-Z]"


cat myfile names 1>&2 > tr "[a-z]""[A-Z]"


cat myfile names 1&2 | tr "[a-z]""[A-Z]"


None of these will work since you cannot combine stdout and stderr under the Bash Shell.

cat myfile names |& tr "[a-z]" "[A-Z]"

You can change your default login shell with the following command:




set shell


setenv shell


chsh


Both A and B are correct.


None of the above

chsh

How is command line editing implemented under the Bash Shell?




The pico editor.


the Editor LIbrary


the Readline LIbrary


the Command Library

the Readline LIbrary

What command displays commands from the history list?




show history


history


hs


set history

history

If your search path does not include the path to a particular shell file, and you try to run that shell file by typing its name on the command line, what happens?




You will be prompted to enter the path to the shell file.


You will get an error message of "command not found"..


Nothing, and, a prompt for a new command will be displayed.


None of the above

You will get an error message of "command not found"..

If whoson is a newly created Bash shell script without execute permissions, what command will allow it to be executed?




execute whoson


run whoson


whoson +x


whoson


None of the above

None of the above

What is the character used to separate elements on the Linux command line?




Space character


Tab character


Newline character


All of the above


None of the above

All of the above

Under the Bash Shell the command: cat myaliases > ronsaka 2> errors will




sends any error messages to file "errors"


redirects stdout to file "ronsaka"


create the file "ronsaka" even if file "myaliases" does not exist.


All of the above.

All of the above.

The names of the common shell programs in UNIX are:




Bourne, Korn, and C shells


C , X-Windows, and Bourne shells


Bourne, Bash, and T shells.


Bourne, Bash, Korn, C, and X Shells.

Bourne, Korn, and C shells

Under Bash Shell, the command: echo The current date is `date` creates:




an error message


screen output with the current date displayed.


screen output of "The current date is date"


None of the above

screen output with the current date displayed.

Under Bash shell, the command:


export place=Austin




Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell


creates a file called "place" with the contents equal to "Austin".


generates an error message because the correct command is setenv


None of the above

Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell

Under Bash, how do you turn on the noclobber feature.




noclobber="yes"


set noclobber


set -o noclobber


None of the above

set -o noclobber

Under Bash shell, the following command creates a user-defined shell variable, called name, and initializes it to John Doe:




export name="John Doe"


name= 'John Doe'


name= "John Doe"


All of the above


None of the above because name must be declared before initializing it.

All of the above

The Bash Shell is based upon and compatible with the




The Unix Bourne Shell


The Korn Shell


The C Shell


All of the above.


None of the above

The Unix Bourne Shell

When using the Readline Library under Bash, what is the default editor mode?




emacs


vim


pico


ed

emacs

Under Bash shell, the environment variable PATH contains the absolute pathnames of:




A list of directory paths to be searched to locate an external command


Your home directory


Your current directory


None of the above

A list of directory paths to be searched to locate an external command

What is the difference between a shell function and a shell script?




functions are stored in RAM while scripts are stored on disk.


functions are preprocessed (parsed) so they start more quickly than a shell script.


functions are executed in the shell that calls it; while, scripts are executed in a subprocess.


All of the above


Only answers A and C are correct.

All of the above

The command: echo \$person




will display the value of the person variable.


will display the string: "$person"


will generate the error message: "$person not found"


will search the working directory for the file "person"

will display the string: "$person"

What comand makes the file: "myaliases" executable?




chmod u+x myaliases


set -e myaliases


set u+x myaliases


chmod -e myaliases

chmod u+x myaliases

What system calls are made when you run a program from the command line?




fork() and exec()


init() and bash()


process() and exec()


ps() and init()

fork() and exec()

The Bash Shell command to create variable: "SUM" and assign "0" to it is:




set SUM<0


SUM=0


int SUM = 0;


new SUM; set SUM=0

SUM=0

What command will create an alias name dir which will execute the "ls -al" command?




dir = 'ls -al'


alias dir='ls -al'


alias ls -al = dir


alias = dir

alias dir='ls -al'

What is the name of the utility program which will prompt the user for information necessary to set the timezone?




tzselect


timeset


set $TIME


timeselect

tzselect

What command shows a list of the current processes Linux is executing?




ps


process


set


get

ps

The error message: "permission denied" occurs when:




an unauthorized user logs into your account.


a file name entered at the shell prompt is not executable.


when you misspell a command such as "echo" as "echx".


None of the above.

a file name entered at the shell prompt is not executable.

What is a PID?




Personal Identification code


Process Identification Number


Program Initiation Designation Number


Parent Identification Number

Process Identification Number

Which tcsh shell command is used to export a variable to new sub shells so they will be "global"?




export $variable


setenv variable "some value"


set variable = "some value"


This is not possible in the tcsh shell.

setenv variable "some value"

Assuming that execute permission for a shell script named: "testscript" has not been set to on, then this script:




cannot be executed.


can be executed with the command: /bin/tcsh testscript


can be executed by adding as the first line in the script #!/bin/tcsh


can be executed by typing run testscript.

can be executed with the command: /bin/tcsh testscript

Using the tcsh Shell, the total number of command line arguments is stored in variable:




$#argv


$!


$@


All of the above


Both A and B

$#argv

Assume that xfile does not exist and yfile contains the string "hello world", under the Tcsh, what are the contents of the hold file after executing the following command?


cat xfile yfile >& hold




hello world


hello world


No such file or directory


hello world


ErrorNo such file or directory


hello world


error: file not found


None of the above

No such file or directory


hello world

Which of the following features are common to both the tcsh shell and the bash shell?




Aliases


Job control


Command substitution


All of the above.


None of the above are common to both shells.

All of the above.

Assume you are using a Linux system running a tcsh login shell, what local startup files will run when you login?




~/.bashrc, ~/.tcshrc, and ~/.bash_profile.


/etc/.cshlogin, ~/.start and ~/.login


Either ~/.tcshrc or ~/.cshrc; and ~/.login


~/.cshrc, ~/.myprofile, and /etc/.login.

Either ~/.tcshrc or ~/.cshrc; and ~/.login

When using the tcsh Shell, values can be assigned to shell variables with the command:




@


set


setenv


All of the above


B and C only.

All of the above

Under tcsh shell, the environment variable: home


contains the absolute pathname of:




Your current directory


Your home directory


The root directory


All of the above

Your home directory

Given the following statement, in tcsh Shell script: demo1:


if ( -f $argv[1] )


then


set filename = $argv[1]


set fileinfo = `ls -il $filename`


endif


What will be the value of $filename if the following command line is entered? demo1 customers addresses




it will be equal to customers.


it will be equal to addresses.


it's value is undefined because 2 filenames were entered.


it's value is demo1.

it will be equal to customers.

The command:


echo `who | more`




Displays output of the who | more command


Displays the text "who | more"


Display the user id and his/her demographic data.


None of the above

Displays output of the who | more command

What tcsh Shell environmental variable is set equal to the path of the current working directory?




$dir


$cwd


$pwd


$wd

$cwd

What tcsh command will remove variable: country ?




country = null


set country


unset country


None of the above.

unset country

Given, the following tcsh shell command, what is the value of buffer[4]?


buffer = (6 9 3 7 2 4 8 1)




2


7


4


0

7

The first argument on the command line when executing a tcsh shell script is stored in the variable:




$argv[1]


#1


argument1


A or B is correct.

$argv[1]

Given the following tcsh shell statement:


if ( ($#argv == 0) || ($#argv > 1) )
then


echo "Usage: $0 ordinary file"


exit 1


endif


what condition will cause the echo command to be executed?




when $#argv is 1.


if no file name is listed on the command line.


if more than one filename is listed on the command line.


B and C only.


None of the above.

B and C only.

What is globbing?




Globbing is the byproduct of creating too many aliases.


Globbing occurs when you inadvertently modify the path variable to omit /usr/bin.


Globbing refers to the matching of strings containing special characters such as *


Globbing refers to the process of creating environmental variables with identical values but different names.

Globbing refers to the matching of strings containing special characters such as *

Given the following block of code in a tcsh shell script:


#EXAMPLE C


set option = $argv[1]


switch ("$option")


case [dD]: date


breaksw


case [lL]: ls


breaksw


case [wW]: who


breaksw


case [qQ]: exit 0


breaksw


endsw


What value of $option will cause the date to be displayed?




d


D


dD


All of the above.


Responses A or B will work.

Responses A or B will work.

Under tcsh shell, the environment variable: path contains the absolute pathname of:




A set of directories to be searched to locate a command or executable program.


Your home directory


Your current directory


None of the above

A set of directories to be searched to locate a command or executable program.

If the first character in a shell script is NOT a #, the tcsh runs the script:




under the default shell: tcsh


under bash or dashf shells


under sh shell


Both answers B and C are correct.


None of these since the first character must be a # or tcsh generates an error.

under bash or dashf shells

How can you execute a bash shell script from a tcsh login shell?




by making the first character in the file anything but a #


enter on the first line of the script the statement: #! /bin/bash


run the script with the command: "/bin/bash scriptname".


All of the above.

All of the above.

What command allows you to logout without terminating background processes.




continue


nohup


logout -n


break -e

nohup

The relationship between the C shell and the tcsh shell is:




that they are identical.


that the tcsh shell is an expanded version of the C shell.


no relationship at all.


that the tcsh shell is also a C language interpretor.

that the tcsh shell is an expanded version of the C shell.

What tcsh Shell command will create variable username and assign it the value of "George W. Bush"?




set username = George W. Bush


setenv username "George W. Bush"


@username = George W. Bush


All of the above

setenv username "George W. Bush"

Under tcsh shell, the command:


setenv place "New Haven"




Initializes the shell variable place to New Haven and makes a copy of it available to any commands/scripts executed under the shell


Initializes the shell variable place to New Haven and makes it available to the user each time he/she logs in.


creates an error


None of the above

Initializes the shell variable place to New Haven and makes a copy of it available to any commands/scripts executed under the shell

The purpose of the following line in a tcsh shell script:


#!/bin/tcsh


is to:




cause the script to be executed as a tcsh shell script only.


allow the script to be run as a tcsh shell script from a bash shell.


assures that the tcsh shell is the one used to interpret the script.


All of the above


A and B only.

All of the above

How can you interrupt the following script?#!/bin/tcsh


onintr close


while (1)


echo "Program is running in a loop"


sleep 2


end


close:


rm -f /tmp/$$*


echo "End of Program"




Enter a SHIFT-I


Enter CONTROL-C


Enter the ESC key


Type "kill last"

Enter CONTROL-C

What are "builtin" commands?




They are the executable command files located in /usr/bin/builtin.


They are the system calls to the Linux kernel.


They are the command files which are packaged with the Linux distribution.


None of the above.

None of the above.

What is the result of the following tcsh Shell command?


set name = John Doe II




variable name is created with the value of John Doe II.


variable name is created with value of John.


variables name, Doe and II are created.


None of the above


B and C are correct.

B and C are correct.

Given the following code segment in a tcsh shell script,


while ("$secretcode" != "$yourguess")


echo "Good guess but try again!"


echo -n "Enter your guess: "


set yourguess = `head -1`


end


What will cause the loop to continue?




When $yourguess is equal to $secretcode.


When $secretcode gets a new value.


When $secretcode is equal to head -1


When $yourguess is not equal to $secretcode.

When $yourguess is not equal to $secretcode.

What is the result of the following tcsh Shell command?


set line = "$<"




outputs the first line of a redirected text file.


reads one one line from stdin into variable "line".


resets the variable "line" to the string "head 1"


stores the first line of head in variable "line".

reads one one line from stdin into variable "line".

How are arithmetic calculations performed in a bash shell command?




using the an expression such as x=$((365*24))


using the "calc"; for example calc x=365*24


using the assignment operator; for example x=365*24


arithmetic calculations can't be performed in a bash shell command

using the an expression such as x=$((365*24))

Referring to the shell script below, what is the value of $# when the loop terminates?




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do sum=$((sum+$1)) # Add the next number to the running sum count=$((count+1)) # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




0


7


1


undefined

0

Referring to the example shell script below, what would happen if you deleted the shift command?




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do sum=$((sum+$1)) # Add the next number to the running sum count=$((count+1)) # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




An infinitely executing loop occurs.


Both Sum and Count would be equal to 7.


The exit status is set to 1.


All of the above.

An infinitely executing loop occurs.

The interrupt processing feature of the bash shell:




allows a shell to ignore interrupts.


intercepts an interrupt and takes a specified action.


allows the creation of new interrupts as desired.


All of the above.


A and B only.

A and B only.

In the bash Shell the following command


exec < customer


results in the following:




Opens file customer as stdin.


Attaches file customer to stdout.


Executes shell script customer.


None of the above.

Opens file customer as stdin.

What is the result of the following command line? echo Number of days in 60 years: $((60*365))




generates an "unexpected token" error message


displays: Number of days in 60 years: 21900


displays "Number of days in 60 years: $((60*365))"


none of these; you must use the let command.

displays: Number of days in 60 years: 21900

If the current value of the bash shell variable total is equal to 10, the following command displays 100:




echo `$total \* 10`


echo $((total*10))


echo `pow($total,2))`


Both A and C are correct


None of the above

echo $((total*10))

Inside a bash shell script, you can access the PID of the script using which of the following environment variables:




$#


$!


$$


All of the above


None of the above

$$

The hangup interrupt is created when:




a user disconnects from a connection.


a user logs out of the system.


a time out occurs in the time sharing algorithm.


All of the above


A and B only.

A and B only.

The exec command can be used to:




to open and close file descriptors.


to make a file executable.


to allow a superuser login session.


All of the above.

to open and close file descriptors.

If the bash shell variable total is equal to 15, which of the following commands displays 3?




echo $ (($total / 4))


echo $(($total%4))


echo $(($total/5))


All of the above


None of the above

All of the above

The here document:




is standard on Linux systems and can be found at /usr/sbin/here.


is useful in encapsulating data which changes frequently


is available only in the tcsh shell.


redirects standard input to a command and attaches it to data typed into a script.

redirects standard input to a command and attaches it to data typed into a script.

What does the following command do?mystery () {who date ls}




Executes the function called mystery.


creates a shell script encapsulating who, date, and ls.


Creates a function that will execute the commands: who, date , and ls in sequence when called


All of the above


A and C only.

Creates a function that will execute the commands: who, date , and ls in sequence when called

A function is used:




to create an encapsulated block of code to be called when needed in a shell script.


must be created in a C program and then compiled.


is legal only in the tcsh shell.


none of the above.

to create an encapsulated block of code to be called when needed in a shell script.

If the command:


exec date


is typed at the bash command line, what happens.




the date is displayed.


the login session is terminated.


an error occurs.


All of the above.


A and B only.

A and B only.

A keyboard interrupt is:




created by typing CONTROL- C.


generates signal 9.


defaults to the killall command.


All of the above.


A and B only.

created by typing CONTROL- C.

An interrupt is generated by:




entering control C.


logging out of the system.


by the kill command.


All of the above.


A and C only.

All of the above.

Referring to the shell script below, what is the purpose of the exit commands?




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do sum=$((sum+$1)) # Add the next number to the running sum count=$((count+1)) # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




Provides an exit from the loop.


Terminates the shell script.


Provide a numeric exit status value.


All of the above.


B and C only.

B and C only.

When the command:


kill 12345


is executed, the following signal is sent to the process with process ID 12345:




HUP


TERM


INT


SIGKILL


None of the above

TERM

Referring to the shell script below, what does the shift command do?




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do sum=$((sum+$1)) # Add the next number to the running sum count=$((count+1)) # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




shifts through the arguments on the command line.


assigns the values on the command line to $1 in sequence.


causes the value $# to be recalculated.


All of the above.


B and C only.

All of the above.

In the shell script below, what occurs if no command line argument is entered after the script name?




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do sum=$((sum+$1)) # Add the next number to the running sum count=$((count+1)) # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




The correct usage message


"Usage: addall number-list"


is displayed.


The script stops without doing any calculations.


There are no numbers to add.


All of the above.


A and C only.

All of the above.

Assume the following statement occurs first in a bash shell script:


if [ $# = 0 ]


then


directory="~"


fi


What happens if the shell script is run without an argument?




The user's home directory is used.


The current working directory is used.


The user will be asked to supply a directory.


None of the above

The user's home directory is used.

Assume the following is entered into a bash shell script:


ct=0


ls ~ | while read file


do


ct=$(($ct+1))


echo $ct. $file


done


What will be displayed?




The count of the number of files in the user's home directory.


Each entry in the user's home directory.


The file permissions of each entry in the user's home directory.


All of the above.


A and B only.

A and B only.

If the following command occurs in a bash shell script:


trap ' ' 2 3


what will occur when it is executed.




the interrupts in the list are ignored.


signals 2 and 3 will cause the script to terminate.


all signals except 2 and 3 are ignored.


the trap command works only in the tcsh shell.

the interrupts in the list are ignored.

You can display names and current values of all bash shell environment variables with the following command:




printenv


setenv


env


Both A and C are correct.


None of the above

Both A and C are correct.

You can display the signals supported by your Linux system with the following command:




echo $signals


kill -l


onintr all


All of the above


None of the above

kill -l

Under bash shell, you can use the following command to read a line from stdin into a variable called word:




read word


set word = `head 1`


@ word < `head 1`


readline word


None of the above

read word

Which of the following commands increments the value of a bash shell variable, sum, by one:




sum = $sum + 1


sum=$(($sum+1))


sum += 1


$sum++


Both A and B are correct.

sum=$(($sum+1))

Under the bash shell, the command


set $(date)


is used to:




Displays the output of the command: date


Sets the variable argv to the the output of the date command


Set the positional parameters to the output of the date command


Both A and C are correct.


None of the above

Set the positional parameters to the output of the date command

Referring to the following shell script, what would happen if a user typed the following command line? command line:




addall 1 4 9 16 25 36 49




#!/usr/bin/bash # EXAMPLE shell script # Filename addall # Purpose: To demonstrate use of numeric calculations# Brief Description: Maintain running sum of numbers in a numeric# variable called sum, starting with 0. Read# the next integer and add it to sum. When all# elements have been read, stop and display the# answer.# If run with no arguments, inform the user of command syntaxif [ $# = 0 ] then echo .Usage: $0 number-list. exit 1 fisum=0 # Running sum initialized to 0count=0 # Count the count of numbers passed as argumentswhile [ $# != 0 ]do let sum=sum+$1 # Add the next number to the running sum let count=count+1 # Update count of numbers added so far shift # Shift the counted number outdone# Display final sumecho .The sum of the given $count numbers is $sum..exit 0




count is equal to 7


sum is equal to 139


an error occurs after the done statement


all of the above.

count is equal to 7