Linux Bash Arithmetic Expressions Question:

How can you come out of the loop in this program?
#!/bin/bash
read x
while [ $x != "hello" ]
do
echo "Try to come out of the loop"
read x
done
echo "Welcome"
exit 0
a) by entering "hello"
b) by entering anything except "hello"
c) it is not possible
d) none of the mentioned

Linux Bash Arithmetic Expressions Interview Question
Linux Bash Arithmetic Expressions Interview Question

Answer:

a) by entering "hello"


Previous QuestionNext Question
What is the output of this program?
#!/bin/bash
echo "Which file do you want to check"
read x
until [ -e $x ]
do
echo "The file does not exist. Do you want to create? y/n"
read a
if [ $a = y ]; then
touch $x
echo "Your file has been created successfully."
fi
done
echo "The file is present in this directory"
exit 0

a) it checks the existance of your entered file in the present working directory
b) it creates the file if file does not exists
c) program runs untill you create the file
d) all of the mentioned
What is the output of this program?
#!/bin/bash
for i in 2 3 7
do
echo "ggl"
done
exit 0
a) 'ggl' will print 3 times
b) nothing will print
c) program will generate an error message
d) none of the mentioned