The CLI send_serial and log_serial sends serial data to the bean and log receives it and sends it to stdout
You can redirect either of these to a text file.
But, with either one you must check the messages to make sure it was able to connect. Sometimes it doesn't connect for unknown reasons (Moon in the wrong phase or the proper hand movements weren't done). When this happens,just retry. Having the wrong name or address will also cause it to fail.
But anything trying to use cli serial commands for anything but debugging is going to be a bit on the kludgey side of things.