I am a bit of a newbie to BASH. So, I am running into trouble encoding the input properly into my script. Mind if you help me set it up correctly? Here is what I have so far:
!/bin/bash
ip=`echo ${1} | sed 's/::ffff://'`
port=${2}
input="FDCB^_^@^@^@Service=RC_SERVICE^^Command=Ping^@^@^@^@"
output=$(echo $input | nc $ip $port -w 5)
if [[ $output == *BusinessCode* ]]
then echo "UP"
fi
When executed, the script waits 1-2 seconds and then pushes nothing to output. After echoing back the input and output variables, it seems the input variable is not being encoded properly. How do I properly encode the extended ASCII chars into a BASH variable?