I need to send the following commands to a busybox device via a serial port:
SBC1000 > setenv serverip '192.168.128.100'
SBC1000 > setenv fsfile '1k\root.jffs2-128k'
SBC1000 > saveenv
I can escape the single quotes of the first line without a problem using a backslash:
cmd = 'setenv serverip \'192.168.128.100\''
I've tried various combinations of backslashes for the second line, but couldn't get the 1k\root part to escape properly. I believe it is being interpreted as a return. I tried double and triple escape with no success.
I finally stumbled upon using
cmd = 'setenv fsfile \'1k\\\u0072oot.jffs2-128k\''
to include the \r ( not a return ) for my string.
Is there a more readable way to include this \r ( not a return ) pattern in my string?