Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Answer: Coding CTRL-D

( #21275=categorized answer: print w/ replies, xml ) Need Help??

Q&A > programs and processes > Coding CTRL-D contributed by athomason

<CTRL-D> can be displayed, printed, sent, or whatever by chr(4). However, this won't fix your script, since 1) echo isn't a Perl command, 2) if it were, it wouldn't print to smbclient, which I assume you're trying to do, and 3) you shouldn't need to send a <CTRL-D> if you do IPC the right way. You need something like

!#/usr/bin/perl -w use strict; my ($victim, $message) = ("joe", "bloop"); # open an output pipe to the external program open SMB, "| smbclient -M $victim"; # print on the pipe's handle print SMB $message; # close the handle, which implicitly sends an EOF close SMB;

Hope that helps.

Comment on Answer: Coding CTRL-D
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-12-26 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls