What is the output of this program?
#!/bin/bash
var1=10
$var1=20
echo $var1
exit 0
a) program will print 10
b) program will generate a warning message
c) program will print 20
d) both (a) and (b)
Submitted by: Murtazad) both (a) and (b)
Explanation:
The doller sign ($) is used to access a variable's value, not to define it.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: line 3: 10=20: command not found
10
root@ubuntu:/home/google#
Submitted by: Murtaza
Explanation:
The doller sign ($) is used to access a variable's value, not to define it.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: line 3: 10=20: command not found
10
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. |