Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle ctrl +d programmatically?

Tags:

c

shell

perl

I am trying to execute the following perl script.

  ##some code
  $command = "nail -s this is a test  $email";
  system($command);
  ##some code 

when I run this script, it hangs until I press CtrlD. after pressing CtrlD I get the desired result. My question is how can I hardcode CtrlD in my script?

like image 999
Uttam Malakar Avatar asked May 15 '26 01:05

Uttam Malakar


1 Answers

I suppose you call mailx. nail ist most likely an alias. It expects input from STDIN, which is ended with CtrlD. You could workaround like this to send an empty mail:

$command = 'echo "" | nail -s SUBJECT ' . $email;
like image 115
marderh Avatar answered May 16 '26 15:05

marderh