0

I have two Perl scripts and want to use one script from another.

The scripts are called script1.pl and script2.pl.

I want to run the below command inside script1.pl :

/home/user/script2.pl /var/log/fw_log error >>/tmp/error.log
1

You can do this with the Perl's built-in 'system' function:

system "/home/user/script2.pl /var/log/fw_log error >>/tmp/error.log";
  • Hi @drg, Thanks for the reply. I've used below but getting error: system "/home/user/script2.pl" "${BASE_DIR}/${i}/fw_log error" >> "${AUDATA}.${i}"; But getting error – rh.mahfuz Jul 18 '16 at 8:05
  • The Error is: String found where operator expected at ./script1.pl line 23, near ""/home/user/script2.pl" "${BASE_DIR}/${i}/fw_log error"" (Missing operator before "${BASE_DIR}/${i}/fw_log error"?) syntax error at ./script1.pl line 23, near ""/home/user/script2.pl" "${BASE_DIR}/${i}/fw_log error"" Execution of ./script1.pl aborted due to compilation errors. – rh.mahfuz Jul 18 '16 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.