Shell Scripting Quiz (Set 7) Shell Scripting (Set 7) 1 / 10 In a shell script, how do you perform exponentiation? $((num1 ^ num2)) $((num1 ** num2)) $[num1 ** num2] $[num1 ^ num2] 2 / 10 What is the purpose of the 'rev' command in a shell script? Prints files in reverse order Renames files Reverses the order of characters in a line Reverts changes made by a script 3 / 10 In a shell script, how do you check if a file is executable? if [ -x file.sh ]; then if [ file.sh -x ]; then if [ executable(file.sh) ]; then if [ file.sh is executable ]; then 4 / 10 What is the purpose of the 'shift' command in a shell script? Shifts the positional parameters to the right Shifts the positional parameters to the left Shifts the positional parameters by a specified number Shifts the script's arguments to the left 5 / 10 In a shell script, how do you access the command-line arguments? $args $@ $arguments $params 6 / 10 What is the purpose of the 'printf' command in a shell script? Prints environment variables Writes output to a file Performs arithmetic operations Formats and prints text 7 / 10 Which operator is used for string concatenation in a shell script? $str1$str2 $str1 + $str2 $str1.$str2 $str1 & $str2 8 / 10 What is the purpose of the 'kill' command in a shell script? Sends signals to processes to manage their behavior Terminates the script Deletes files Prints process information 9 / 10 In a shell script, how do you iterate over files in a directory? for file in /path/to/directory/; do for file in directory/*; do for file in /path/to/directory/*; do foreach file in /path/to/directory/*; do 10 / 10 What is the purpose of the 'case' statement in a shell script? Defines user-defined functions Performs pattern-based branching Catches errors in the script Creates loops Your score isThe average score is 0% 0% Restart quiz