problem with telnet
i write this script:
echo "please enter 2 numbers: "
read -r A B
echo your numbers is $A and $B
i make this script to become a service ( i test it from bash, and my script work good), my problem is when i telnet to my local host (127.0.0.1) via a personal port like 5555 telnet give this error: ")syntax error: invalid arithmetic operator (error token is ", i know this error is for echo $(($A+$B)) and i know that telnet can not calculate $A+$B and the error is for this, but i want a solution for this problem, any suggestion...
telnet? This has nothing whatsoever to do with telnet. How are you using telnet with this? something messy with xinetd? Unless you are actually connecting to a telnet server, then this is not about telnet.
first i write this script
then make this service file under the /etc/xinetd.d/filename:
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/service-test
port = 5555
then add my personal port like 5555 to /etc/services file
then open this port in iptables (firewall)
at last i telnet to my local host to test this service:
telnet 127.0.0.1 5555
then its prompt me to give it two numbers (echo "please enter 2 numbers: ")
but when i type two numbers and push enter button, (script continue) in line echo $(($A+$B)) that error appear, i used set -x and i found the line that gives error, and i know this is because of sum two numbers line.
I tried your script on Slackware on a telnet session and it works.
Will you post the output of:
|All times are GMT -5. The time now is 05:21 PM.|