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
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityYou can do this with the Perl's built-in 'system' function:
system "/home/user/script2.pl /var/log/fw_log error >>/tmp/error.log";
system "/home/user/script2.pl" "${BASE_DIR}/${i}/fw_log error" >> "${AUDATA}.${i}";
But getting error
Jul 18, 2016 at 8:05
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.
Jul 18, 2016 at 8:18