I'm trying to compare a variable with a String but I have not found a way to do it, the variable is the result of a function, which result can be "Terminal" or "Server", which I can print without any problem, the problem is that I can not find a way to compare it with a string, here my code:
function seleccionar(){
osascript <<EOT
set rTipo to the button returned of (display dialog "$1" buttons {"Terminal", "Servidor"} default button "Servidor")
if(rTipo = "Terminal")then
return rTipo
do shell script "echo 'type=terminal'> ~/Desktop/type.txt"
end if
if(rTipo = "Servidor")then
return rTipo
do shell script "echo 'type=servidor'> ~/Desktop/type.txt"
end if
EOT
}
value="$(seleccionar 'Selecciona el tipo de instalacion:')"
echo $value
I seek to compare it this way:
if value == "Servidor ; then
if lsof -Pi :3306 -sTCP:LISTEN -t >/dev/null ; then #comprueba el puerto 3306
echo "El puerto 3306 ya se encuentra en uso"
exit 1
fi
fi
is there any way?