On Wed, Mar 11, 2009 at 12:27:39AM +0100, Jamie Lokier wrote:
> If you're using a no-MMU architecture, you may get better results with
> 
>    sh -c 'sleep 2; echo "username"; sleep 2; echo "pwd"' | ftp 10.0.0.24
> 
> (for example).

Yes, that's right. buysbox/msh has some problems when it comes to subshells,
pipes and internal commands. It's easy to test this using `cat' instead
of ftp:

# ( date; sleep 2; date ; sleep 2; date ) | cat
Wed Mar 11 07:09:17 UTC 2009
Wed Mar 11 07:09:17 UTC 2009
Wed Mar 11 07:09:17 UTC 2009

# sh -c 'date; sleep 2; date ; sleep 2; date' | cat
Wed Mar 11 07:09:29 UTC 2009
Wed Mar 11 07:09:31 UTC 2009
Wed Mar 11 07:09:33 UTC 2009

# ( date; sleep 2; date ; sleep 2; date )
Wed Mar 11 07:10:03 UTC 2009
Wed Mar 11 07:10:05 UTC 2009
Wed Mar 11 07:10:07 UTC 2009

In general, it's a "hack" to drive real interactive programs like `ftp'
and `telnet' from pipes. You'd better use something like `expect' for
that. Of course, that's not an option on small embedded (NOMMU) systems.
So better use non-interactive tools like `netcat' or `rsh'-like stuff
instead.

Enrik
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to