Bash Are Equally Strong
are_equally_strong() {
local _yourLeft=$1 _yourRight=$2 _friendsLeft=$3 _friendsRight=$4
local _maxYou=$(( _yourRight > _yourLeft ? _yourRight : _yourLeft ))
local _maxFriend=$(( _friendsLeft > _friendsRight ? _friendsLeft : _friendsRight ))
local _minYou=$(( _yourLeft < _yourRight ? _yourLeft : _yourRight ))
local _minFriend=$(( _friendsRight < _friendsLeft ? _friendsRight : _friendsLeft ))
if (( _maxYou == _maxFriend && _minYou == _minFriend )); then
echo true
else
echo false
fi
}
This compares each person’s strongest and weakest arm. If both pairs match, the result is true.