need to script connection to telnet and send commands to remote device with no user input Ok I need some help making a script that will connect to a server and send 2 commands

Ideally I would have telnet 192.168.2.230 9993

and once it logs in (no user name or password required - the server is air gapped)

once the connection is created the script would send the following commands:

remote: enable: true

record: true

So far I can only get it to connect to the remote device - any help is greatly appreciated!!
Expect

Mac OS X includes the command line tool expect:


  expect - programmed dialogue with interactive programs


expect is ideal for scripted interactions with other tools, like telnet. 

The following questions discuss how to use expect and telnet together:


How to automate telnet session using Expect?
expect script to automate telnet login
Shell script successful telnet login, how to issue commands after that?


Connect and Send

The following shell script may be enough for your two commands:

#!/usr/bin/expect -f
spawn telnet 192.168.2.230 9993
send "remote: enable: true\n"
send "record: true\n"


There are a number of ways to use the above script. One is to save the script as a text file called myscript.command; opening the file will then launch Terminal.app and run the script.

Alternatively, the script could be wrapped in an Automator action or AppleScript.