Linux OS Shell Question: Download Questions PDF
What is the output of this program?
#!/bin/sh
san_function() {
echo "Welcome to the google"
printf "World of Linuxn"
}
unset -f san_function
san_function
exit 0
a) Welcome to the google
b) World of Linux
c) both (a) and (b)
d) nothing will print
![Linux Shell Interview Answer Linux Shell Interview Question](https://globalguideline.com/public/images/interview/17.png)
Answer:
d) nothing will print
Explanation:
Function definition was deleted before calling the function. command 'unset -f function_name' deletes the function definition.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: 6: san_function: not found
root@ubuntu:/home/google#
Explanation:
Function definition was deleted before calling the function. command 'unset -f function_name' deletes the function definition.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: 6: san_function: not found
root@ubuntu:/home/google#
Download Linux Shell Interview Questions And Answers
PDF