What is the output of this program? [code] #!/bin/bash a=10 b=$(( $a<0&#038;&#038;$a<100 )) echo $b exit 0[/code]

Stasenndb

New member
What is the output of this program?
Code:
   #!/bin/bash
   a=10
   b=$(( $a<0&#038;&#038;$a<100 ))
   echo $b
   exit 0
A. 10
B. 0
C. 1
D. none of the mentioned
 
Answer: b
Explanation: The condition '$a<0' is false so logical and operator provides the output 0.
Output:
root@ubuntu:/home/123hoidap# ./test.sh
0
root@ubuntu:/home/123hoidap#
 

Tìm kiếm

Back
Top