Why does the following script gives different outputs, when the same expression is evaluated with and without test? What rules are to be taken into account: operator precedence, left-to-right or right-to-left argument evaluation ...? In my opinion it is important to understand the logic of bash at this basic level.
function a()
{
local r=1
printf "a%d" $r
return $r
}
function b()
{
local r=1
printf "b%d" $r
return $r
}
function c()
{
local r=1
printf "c%d" $r
return $r
}
printf "$BASH_VERSION\n" #outputs 4.3.48(1)-release
a || b && c #outputs a1b1
printf "\n"
test a || b && c #outputs c1
printf "\n"