Interviewer And Interviewee Guide

Linux OS Shell Interview Question:

What is the output of this program?

#!/bin/sh
echo "Just call the function"
san_function
san_function() {
echo "This is a function"
}
exit 0
a) only first string will print without any error
b) only second string will print without any error
c) both strings will print
d) none of the mentioned

Submitted by: Murtaza
d) none of the mentioned
Explanation:
Function must be defined prior to call. Hence only first string will print and program will generate an error also.
Output:
root@ubuntu:/home/globalguideline# ./test.sh
Just call the function
./test.sh: 3: san_function: not found
root@ubuntu:/home/globalguideline#
Submitted by: Murtaza

Read Online Linux OS Shell Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.