Can I use adb shell command to detect the phone support OTG to transmission the files with an USB Flash Drive with OTG function?
Yes. All you need to do is test for the presence of the file that enables it. On devices that do:
Of course, it's possible for a device to be misconfigured — but you have to actually physcially test OTG to determine that.
If the OTG drive is plugged in at the time of the command, you can also detect OTG by querying these directories:
Tested on my collection of devices and a quick trip to Bestbuy for testing the latest flagships listed above. Edited to add input from other members here.