Shell Scripting Quiz (Set 2) Shell Scripting (Set 2) 1 / 10 What is the purpose of the 'shift' command in a shell script? Moves a file to another directory Shifts the positional parameters to the left Changes the permissions of a file Increments a variable's value 2 / 10 In a shell script, how do you declare a variable? variable_name=value declare variable_name value set variable_name to value $variable_name=value 3 / 10 What is the purpose of the 'exit' command in a shell script? Pauses the script temporarily Terminates the script and returns an exit status Skips the current iteration of a loop Restarts the script from the beginning 4 / 10 Which command is used to remove a file in a shell script? delete remove rm discard 5 / 10 What is the purpose of the 'while' loop in a shell script? Executes a block of code a specific number of times Performs conditional branching Repeatedly executes a block of code while a condition is true Iterates over items in an array 6 / 10 Which operator is used for file redirection in a shell script? >> > < | 7 / 10 What is the purpose of the 'echo' command in a shell script? Executes external commands Prints output to the terminal Reads user input Copies files and directories 8 / 10 In a shell script, how do you comment out a single line? // This is a comment /* This is a comment */ -- This is a comment # This is a comment 9 / 10 What is the purpose of the 'sed' command in a shell script? Searches for files Compiles source code Stream editor for text manipulation Executes external commands 10 / 10 Which command is used to list all environment variables in a shell script? env variables listenv showvars Your score isThe average score is 0% 0% Restart quiz