What is the output of this program?
#!/bin/bash
san_var=hello
readonly san_var
san_var=hi
echo $san_var
exit 0
a) hello
b) hi
c) nothing will print
d) none of the mentioned
Submitted by: Murtazaa) hello
Explanation:
After the execution of the 'readonly' command, shell will not provide the permission to overwrite the value stored in variable 'san_var'.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: line 4: san_var: readonly variable
hello
root@ubuntu:/home/google#
Submitted by: Murtaza
Explanation:
After the execution of the 'readonly' command, shell will not provide the permission to overwrite the value stored in variable 'san_var'.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: line 4: san_var: readonly variable
hello
root@ubuntu:/home/google#
Submitted by: Murtaza
Read Online Linux OS Shell Job Interview Questions And Answers
Top Linux OS Shell Questions
☺ | cmd > abc 2>&1 will: |
☺ | The redirection 2> abc implies: |
☺ | Which of these is the correct method for appending \"foo\" in /tmp/bar file? |
☺ | Which one of the following is not a valid shell variable? |
☺ | What will be output of following command: |
Top Linux OS Categories
☺ | Device Drivers Interview Questions. |
☺ | Linux OS Management Interview Questions. |
☺ | Linux Makefile Interview Questions. |
☺ | Linux Environment Interview Questions. |
☺ | Linux OS Shell Interview Questions. |