Not able to call a perl script from a shell script
I am trying to call a perl script from a shell script and code looks like shown below...
shell script test_sh
#Call the script
test2.pl ${PARTITION_ID} ${VNG_USER} ${VNG_PASSWORD} ${VNG_INSTANCE}
if [ $? -ne 0 ]
then
OP1ExitStatus -6
fi
while execution getting below error message:
./test_sh[142]: test2.pl: not found
Failed in test_sh
permission given to both files are 755.
But when i and calling test2.pl directly from the command line by passing all arguments it runs successfully. I tried with below command as well :
#Call the script
perl test2.pl ${PARTITION_ID} ${VNG_USER} ${VNG_PASSWORD} ${VNG_INSTANCE}
if [ $开发者_Python百科? -ne 0 ]
then
OP1ExitStatus -6
fi
but it is also not working. please let me know how to proceed in order to run it successfully.
From the command line you're invoking perl test2.pl
directly. From the script you're assuming that (1) test2.pl
is executable and (2) .
is in $PATH
somewhere. I would use the direct perl
invocation in the script, at least for now.
check your shebang, eg #!/bin/bash
. you may also want to try using the full path of your Perl executable.
That usually means that the path to perl
in the shebang line at the top of the Perl script is wrong (assuming that the file has execute permission for you).
Try using:
#!/usr/bin/env perl
Your shell script is unable to find your test2.pl. You need to give the full path of test2.pl in your shell script or ensure it is in your $PATH.
精彩评论