I’ve been making shell commands for several of my devices; they mostly use netcat to send packets to defined IP addresses. Basically they’re long lists of commands like this:
minidsp_muteon: echo -e “\x03\x17\x01\x1b” | nc 192.168.1.37 5333
I’m wondering if it’s possible for me to make that IP address into a variable, so that I can have all 10-30 commands in each list just say something like:
minidsp_muteon: echo -e “\x03\x17\x01\x1b” | nc {IP_address} 5333
…and then have another file where I set a value for “IP_address” so I don’t have to type it in a dozen or more times.
The problem is that I can’t use a “|” character in a shell command that has a variable in it, and I can’t use Echo and Netcat without a “|” character.
Any idea how I can get around this?