Shell Scripting Quiz (Set 15) Shell Scripting (Set 5) 1 / 10 In a shell script, how do you perform integer division? $((num1 / num2)) $(num1 / num2) div(num1, num2) $[num1 / num2] 2 / 10 What is the purpose of the 'dirname' command in a shell script? Extracts the directory from a path Extracts the filename from a path Prints the working directory Deletes a directory 3 / 10 In a shell script, how do you declare an array? array=[item1 item2 item3] array=(item1 item2 item3) array={item1 item2 item3} array 4 / 10 What is the purpose of the 'tee' command in a shell script? Creates a temporary file Reads from standard input and writes to standard output and files Splits a file into multiple parts Combines files into one 5 / 10 In a shell script, how do you check if a variable is empty? if [ $var == '' ]; then if [ var = '' ]; then if [ -z $var ]; then if [ empty($var) ]; then 6 / 10 What is the purpose of the 'basename' command in a shell script? Extracts the directory from a path Prints the working directory Deletes a file Extracts the filename from a path 7 / 10 Which variable is used to retrieve the exit status of the last executed background command? $? $$ $! $@ 8 / 10 What is the purpose of the 'wc' command in a shell script? Writes content to a file Moves files and directories Counts lines, words, and characters in a file Changes file permissions 9 / 10 In a shell script, how do you find the length of a string? ${#string} $string.length len(string) length(string) 10 / 10 What is the purpose of the 'sleep' command in a shell script? Closes the shell session Pauses script execution for a specified time Deletes files Prints output to the terminal Your score isThe average score is 0% 0% Restart quiz