Answer the question
In order to leave comments, you need to log in
How to add comparison in bash?
What is the principle, if the UUID of the inserted flash drive is equal to the specified UUID value, (or, for example, the list of UUIDs is written to a file), then the UUID output matches
#!/bin/bash
echo "NACHALO"
UUID=$(blkid -s UUID -o value -t TYPE=vfat)
echo "VIVOD UUID"
echo " $UUID"
if [0E48-D3D6 == "$UUID"]; then
echo "good"
else
echo "ne good"
fi
Answer the question
In order to leave comments, you need to log in
You need to understand that this is a program call, and not just a construction.
If you decompose it into components, you get
[ - программа
0E48-D3D6 - первый аргумент
== - второй аргумент
"$UUID" - третий аргумент
] - четвёртый аргумент
[ "0E48-D3D6" "==" "$UUID" "]"
You need to match strings, bash has a separate syntax for that.if [ "$a" -ne "$b" ]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question