Shell Scripting Quiz (Set 19) Shell Scripting (Set 9) 1 / 10 In a shell script, how do you perform arithmetic operations with floating-point numbers? result=$[num1 + num2] result=$((num1 + num2)) result=$(echo $num1 + $num2 | bc -l) result=$(num1 + num2) 2 / 10 What is the purpose of the 'head' command in a shell script? Displays the beginning of a file Displays the end of a file Counts lines, words, and characters Sorts lines of a file 3 / 10 In a shell script, how do you check if a file is readable? if [ file.txt -r ]; then if [ readable(file.txt) ]; then if [ file.txt is readable ]; then if [ -r file.txt ]; then 4 / 10 What is the purpose of the 'expr' command in a shell script? Searches for files Evaluates expressions Counts lines, words, and characters Finds and replaces text 5 / 10 In a shell script, how do you check if a string starts with a specific substring? if [ "${substring}"* = "${string}" ]; then if [ "${string}" starts with "${substring}" ]; then if [ "${string}" = "${substring}"* ]; then if [ starts with "${substring}" "${string}" ]; then 6 / 10 What is the purpose of the 'ls' command in a shell script? Deletes files Lists files and directories Prints the working directory Counts lines, words, and characters 7 / 10 Which operator is used for file redirection in a shell script? | > >> < 8 / 10 What is the purpose of the 'expr' command in a shell script? Evaluates expressions Counts the number of lines in a file Displays environment variables Searches for text patterns 9 / 10 In a shell script, how do you get the current date and time? current_datetime=date current_datetime=$(date '+%Y-%m-%d %H:%M:%S') current_datetime=$(time) current_datetime=time 10 / 10 What is the purpose of the 'sed' command in a shell script? Stream editor for text manipulation Searches for files Counts lines, words, and characters Deletes lines from a file Your score isThe average score is 0% 0% Restart quiz