Shell Scripting Quiz (Set 10) Shell Scripting (Set 10) 1 / 10 In a shell script, how do you perform modulus division? $((num1 % num2)) $[num1 % num2] $(num1 % num2) $((num1 mod 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 define a constant variable? const_var=value readonly var=value define var=value constant var=value 4 / 10 What is the purpose of the 'grep' command in a shell script? Deletes files Compiles source code Searches for patterns in text Prints the working directory 5 / 10 In a shell script, how do you check if a variable is not empty? if [ $var != '' ]; then if [ var != '' ]; then if [ notempty($var) ]; then if [ -n $var ]; then 6 / 10 What is the purpose of the 'env' command in a shell script? Executes a command in a new environment Creates a new environment variable Displays environment variables Exports variables to subshells 7 / 10 Which operator is used for command substitution in a shell script? $( ) ${ } ` ` 8 / 10 What is the purpose of the 'mkdir' command in a shell script? Creates directories Deletes directories Moves files Searches for files 9 / 10 In a shell script, how do you get the length of an array? $array.length length(array) ${#array[@]} $[array.length] 10 / 10 What is the purpose of the 'basename' command in a shell script? Extracts the directory from a path Extracts the filename from a path Prints the working directory Deletes a file Your score isThe average score is 0% 0% Restart quiz