Search code examples
linuxperlat-command

How to pass an argument to a perl script


 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.


Solution

  • 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`;