Shell functions use printf() to print output to stdout. Thus, you would need to redirect printf() to some other file.
This can be done for example by _io_set_handle(IO_STDOUT, fh_ptr);
as in the example
Please check this demo, it examines the two UART modules at the same time. The serial driver is used. The default serial port and one additional serial port are invoked. Different messages- strings of characters -are sent over each serial port and displayed over the output terminals.
I hope this helps.
Note: If this post answers your question, please click the Correct Answer button or helpful. Thank you!