I have a simple bash script.
# Which display is HDMI ?
for i in `seq 0 $displayLoopCounter`
do
name=$(adb shell cat /sys/devices/platform/omapdss/display$i/name)
if [ "$name"=="hdmi" ] ; then
echo "$name"
hdmiDisplay="display$i"
fi
done
OUTPUT of my scipt:
dvi
hdmi
I’m running the scripts using bash myscript.sh
display0 is dvi
display1 is hdmi
Your problem lies with the fact that you don’t have spaces around the
==in yourifline. That makes it a single-argument expression about which thebashmanpage states:If you run the following script (with no spaces around the
==):you’ll see that the output has both lines,
HelloandfileData. Putting the spaces in, you’ll get onlyfileDatabecause that same manpage states: