Customize pixhawk

hi, all
I want to create loop check in script file to check telemetry 1 or 2 check , and if the telemetry port received a simple character from arduino board the pixhawk booted continue and work correctly,
does anyone can help me, i try to create loop code with while <> do done in rc.txt script to check telemetry port but it seems the loop command not work.
please help me.

best regards.