Bash script via inetd = no joy
From: tylernt (tylernt_at_yahoo.com)
Date: 08/29/03
- Next message: Chris F.A. Johnson: "Re: Question"
- Previous message: Kevin Rodgers: "Re: Translation - Input from a variable and a file"
- Next in thread: Barry Margolin: "Re: Bash script via inetd = no joy"
- Reply: Barry Margolin: "Re: Bash script via inetd = no joy"
- Reply: laura fairhead: "Re: Bash script via inetd = no joy"
- Reply: Dan Mercer: "Re: Bash script via inetd = no joy"
- Reply: tylernt: "Re: Bash script via inetd = no joy"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Aug 2003 11:10:53 -0700
Hello,
I wrote a Bash script in Linux using 'read' and 'echo'. The script
works just fine from the console.
However, when I put it in services and inetd.conf and then telnet in
to run it, I get a stairstep effect: after the script 'echo'es
something and then tries to 'read' something, the cursor is placed
below the last character printed from the 'echo' rather than in the
leftmost column. Like LF was issued but not CR. This occurs using both
the Win2k telnet client and from the Linux telnet client.
Also. If I 'echo' back the variable that I just 'read', it shows what
I typed in, but none of my 'if' statement logic recognizes the string
(perhaps because there is a hidden CR and/or LF attached?).
It seems to be a CRLF thing... any idea how to run a Bash script that
uses 'echo' and 'read' via inetd? Or are there equivalent Bash
commands that are more CRLF friendly when run through inetd? Or can I
append some CR/LF codes to my 'echo'es and strip extra CR/LFs from my
'read's somehow?
And yes, I know this is a huge security hole but it's in a protected
test environemnt.
Please help... Thanks in advance!! Here is the script:
#!/bin/bash
echo "Greetings"
read myinput
until [ "$myinput" = "quit" ]
do
if [ "$myinput" = "data" ]; then
echo "Enter your data"
read mydata
until [ "$mydata" = "stop" ]
do
echo $mydata >> ~/output.txt
read mydata
done
echo "Data received"
else
echo "Unknown command"
fi
read myinput
done
echo "Goodbye"
- Next message: Chris F.A. Johnson: "Re: Question"
- Previous message: Kevin Rodgers: "Re: Translation - Input from a variable and a file"
- Next in thread: Barry Margolin: "Re: Bash script via inetd = no joy"
- Reply: Barry Margolin: "Re: Bash script via inetd = no joy"
- Reply: laura fairhead: "Re: Bash script via inetd = no joy"
- Reply: Dan Mercer: "Re: Bash script via inetd = no joy"
- Reply: tylernt: "Re: Bash script via inetd = no joy"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|