Linux Bash Arithmetic Expressions Question:
Download Questions PDF

After running this program, as your press 4, what will be the output of the program?
#!/bin/bash
echo "How many times you want to print 'globalguideline'"
read value
for ((i=0;i<$value;i++))
do
echo "globalguideline";
done
exit 0
a) 'globalguideline' will print 4 times
b) 'globalguideline' will print 3 times
c) 'globalguideline' will print 5 times
d) program will generate an error message

Answer:

a) 'globalguideline' will print 4 times

Download Linux Bash Arithmetic Expressions Interview Questions And Answers PDF

Previous QuestionNext Question
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
5. After running this program, as you press 's', what will be the output of the program?
#!/bin/bash
echo "press 's' to print interviewquestionsanswers"
read var
if $var=s
then
echo "interviewquestionsanswers"
else
echo "You did not press s"
fi
exit 0
a) interviewquestionsanswers
b) You did not press s
c) program will generate an error message
d) none of the mentioned