[NTLUG:Discuss] Scripting help
Leroy Tennison
leroy.tennison at verizon.net
Mon Oct 13 20:56:59 CDT 2014
Thanks for the reply, I must admit, I'm learning a lot (the hard way)
from this "exercise". Went and read 'man xargs' because of your post
and noticed:
" -a file
Read items from file instead of standard input. If you
use this option, stdin remains unchanged when commands
are run. Otherwise, stdin is redirected from /dev/null.
"
This explains what you are saying perfectly. It looks like my only
option for using this approach is to create a file in /tmp (further
investigation since my original post discovered this, wonder how the
administrator will feel about that or if they would even notice).
On 10/13/2014 01:57 PM, Eric Schnoebelen wrote:
> Leroy Tennison writes:
> - Well, interesting result, it obviously did telnet to the devices
> - (got Trying .., Connected to..., Escape character is ..) but
> - then "Connection closed by foreign host." before ever showing me
> - the login screen (three times, once for each device in my list)
>
> That's likely because telnet does not have standard input when
> executed via xargs. So, telnet gets connected, then tries to
> read from standard input, gets an EOF, and starts shutting down.
>
> - On 10/09/2014 09:13 PM, Christopher Cox wrote:
> - > On 09/24/2014 10:24 PM, Leroy Tennison wrote:
> - >> I'm trying to get telnet to repetitively connect to a
> - >> newline-delimited list of devices. In other words, if I have
> - >> device1, device2 and device3 then what I want is:
> - >>
> - >> telnet device1
> - >> telnet device2
> - >> telnet device3
> - >>
> - > xargs -n1 telnet <<HERE
> - > device1
> - > device2
> - > device3
> - > ...
> - > deviceN
> - > HERE
>
> --
> Eric Schnoebelen eric at cirr.com http://www.cirr.com
> "Memory is like an orgasm. It's a lot better if you don't
> have to fake it." -Seymore Cray, on virtual memory
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
More information about the Discuss
mailing list