running interactive program from shell script

Steven Friedrich FreeBSD at insightbb.com
Mon Jan 31 11:22:42 PST 2005


On Sunday 30 January 2005 11:23 pm, Jay Moore wrote:
> As for what I'm trying to do:
> I have a requirement to administer a number of remotely located embedded
> devices; these devices do not support ssh - only telnet. To avoid the
> obvious security issues, I am going to co-locate a "real" computer at each
> remote location. I will ssh into the "real" computer, and then telnet over
> a local network to the embedded device(s). I realize there are many ways of
> accomplishing this, but I'm kind of hung up on doing it "my way"  :)
>
> > > #! /bin/sh
> > >
> > >     (sleep 3;
> > >     echo "password";
> > >     sleep 3;
> > >     echo "ls -la";
> > >     sleep 3;
> > >     ) | telnet -l user 192.168.0.2
> >

I think all you need is to enclose it with a forever for loop.
I can't remember the syntax right now, but you can probably read man sh and 
figure it out. If you can't, let us know and I'll work it out...


More information about the freebsd-questions mailing list