Shell Scripting Quiz (Set 8) Shell Scripting (Set 8) 1 / 10 In a shell script, how do you perform floating-point division? $(echo $num1 / $num2 | bc -l) $[num1 / num2] $((num1 / num2)) $(num1 / num2) 2 / 10 What is the purpose of the 'tr' command in a shell script? Transforms files into directories Translates or deletes characters Counts lines, words, and characters Tracks file changes 3 / 10 In a shell script, how do you declare a function? function_name() { commands; } function name { commands; } function(name) { commands; } function(name): commands; 4 / 10 What is the purpose of the 'cut' command in a shell script? Deletes lines from a file Copies files and directories Extracts specific columns from text Finds and replaces text 5 / 10 In a shell script, how do you prompt the user for input and assign it to a variable? input var get var read var userinput var 6 / 10 What is the purpose of the 'dirname' command in a shell script? Extracts the filename from a path Extracts the directory from a path Prints the working directory Deletes a directory 7 / 10 Which operator is used for string comparison in a shell script? = != -eq == 8 / 10 What is the purpose of the 'sort' command in a shell script? Searches for files Sorts lines of text files Counts lines, words, and characters Reverses the order of lines 9 / 10 In a shell script, how do you capture the output of a command into a variable? result=command result=`command` result=(command) result=$(command) 10 / 10 What is the purpose of the 'grep' command in a shell script? Deletes files Searches for patterns in text Compiles source code Prints the working directory Your score isThe average score is 0% 0% Restart quiz