This is for my doorknocker.
Here's a simplified version of what I need the script to do:

Code:
#!/system/bin/sh
ipaddr=$(ping -c1 google.com 2>/dev/null | sed -n -e 's/^PING google.com (\([0-9.]*\).*/\1/p')
telnet $ipaddr 1234 &
sleep 1
kill $!
exit


The ping command is the only thing I've found thus far on Android for resolving a hostname to an IP address. The telnet command I have here demands IP, not hostname.

The script I have works, as does the sample script above.
And I've managed to tie it to a widget (desktop button), but clicking it opens a terminal window that must then be closed manually.


Edited by mlord (08/08/2012 20:11)