Smarts: How to run sm_perl scripts as executables; After adding the path to sm_perl into the Perl script shebang (#!), the script produces several errors such as "command not found"
search cancel

Smarts: How to run sm_perl scripts as executables; After adding the path to sm_perl into the Perl script shebang (#!), the script produces several errors such as "command not found"

book

Article ID: 323803

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

Symptoms:


How to run Smarts sm_perl scripts as executables
How to run Smarts Perl script without calling sm_perl directly

 

After adding the path to Smarts sm_perl into the Perl script shebang (#!), the script produces several errors, such as the following:

use: command not found



Environment

VMware Smart Assurance - SMARTS

Resolution

To run Smarts sm_perl scripts as executables, you can use a pattern suggested on the perlrun doc from perl itself (perldoc perlrun). This is done as follows:
  1. Add the following as the first line in your Perl script:

    #!/bin/sh -- # -*- perl -*-
               eval 'exec /app/InCharge8/IP/smarts/bin/sm_perl -S $0 ${1+"$@"}'
               if 0;


     
  2. Run the following command:

    chmod 777 <your Perl script> 

     
  3. You can now invoke your Perl scipt directly with "<path>/<perl script>" instead of using "sm_perl <path>/<perl script>"