Re: running a script with tcpserver
Ketil Froyn <[email protected]>
| Newsgroups | gmane.comp.misc.pape.general |
|---|---|
| Message-ID | <1093276892.25215.112.camel@ketil> |
On Mon, 2004-08-23 at 15:54, Payal Rathod wrote: > Hi, > I want to make and run a simple script on port say 1234 which will > print output of ls -l /usr/designs when user types "name" and > exit if something else. > Something like, > > if [ "$1" = "name" ] > then > ls -l /usr/designs > else > # echo "hello" > exit > fi > > But this does not work. I also tried running recordio before it. But all > it does it exits ( or prints hello ). > Any ideas why? I have a feeling that some extra characters are insrted > but no idea of knowing which This probably happens because you are reading the first argument on the command line with $1, but the input received over the network is on STDIN. Read this page for everything you need to use tcpserver: http://cr.yp.to/ucspi-tcp/tcpserver.html and you can test your program directly by doing something like this: echo name | ./my-program.sh Ketil Froyn [email protected] http://ketil.froyn.name/