-2
 my @return = `at now +3 days -f test2.pl myargument 2>&1`;

How do I pass that myargument to my script test2.pl? In that code it returns an error.

Cadz
  • 139
  • 3
  • 21
  • 2
    This does not seem to be a problem with Perl, but with your usage of the `at` command. To make debugging easier, it may be better to rephrase this question without any references to Perl. e.g. try executing `echo hello world` in two minutes directly from the command line. – amon Oct 03 '17 at 17:12

1 Answers1

1

According to the documentation for at on my system, it reads bourne shell commands to be executed from from the file specified with -f or STDIN.

As such, the following should do the trick:

`printf %s 'test2.pl myargument' | at now +3 days 2>&1`;
HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
ikegami
  • 367,544
  • 15
  • 269
  • 518
  • In my script i need to send an email which needs to be sent in a later time handled by the at command. In your solution which works, it sends the email first then create the job. Please help – Cadz Oct 04 '17 at 09:49
  • I bet you actually used `\`test2.pl myargument | at now +3 days 2>&1\`` – ikegami Oct 04 '17 at 15:14