Shell A calls another shell B script. How does script B return data and how does A receive it?

defines a script B that receives two parameters, roughly logical:

if [true]; then
    echo "12"
    exit 0;
else
    echo "error"
    exit 0;
fi

exit 0;

now call this script in another shell script A:

RESULT=./B "para1" "para2"

the problem now is that RESULT does not receive the information returned by echo in B, such as "12" or "error", and always reports an error when running.
could you tell me how to write such a script? Shouldn"t I use RESULT to receive it? Then how to get the information from echo in B? Or how to get the information back in the B script?


RESULT=`./B "para1" "para2"`

or

RESULT=$(./B "para1" "para2")

is wrong in one detail: a space is required between RESULT and . / B . RESULT=. / B "para1"para2" . Otherwise, it will be considered to set the value of RESULT to . / B and then execute "para1" .
same first code if [true]; true of then needs to be separated from [ and ] . if [true]; then

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b384d6-2c0e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b384d6-2c0e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?