Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
We package a version of perl with our commercial software product. (yes, yes boo on me for selling closed source; i don't like it either but one has to pay the bills.) Of course, there's no way to know in advance exactly where a client will install our software - as in what directory structure they will use. So I have to write scripts all the time that need to first find perl, and then run the main body of the code. Since I can depend on sh just about everywhere, for Unix I have a sh script which finds perl for me based on some ENV variables that our software always sets and the runs perl using the old  exec $PERL -x $0 $* trick, $PERL having been set by the sh portion of the code (I'll include full code below for the curious). What I need is a win32 batch script equivalent of this and I don't even know where to begin. Any win32 peeps out there think they can help? I hope this question is clear enough.... =]

We speak the way we breathe. --Fugazi

#!/bin/ksh # -*- perl -*- # these are the varibles you change ####################################### IGNORE_NO_USER=N # 'Y' or 'N' ####################################### # DONT CHANGE STUFF AFTER THIS ARCH=$(uname -s)$(uname -r) if [[ $ARCH = "SunOS5.5.1" ]]; then ARCH=SunOS5.5 elif [[ $(echo $ARCH|grep -c "HP-UXB.10") -gt 0 ]]; then ARCH=HP-UXB.10 elif [[ $(echo $ARCH|grep -c "HP-UXB.11") -gt 0 ]]; then ARCH=HP-UXB.11 elif [[ $(echo $ARCH|grep -c "Linux2.2") -gt 0 ]]; then ARCH=Linux2.2 fi BIN=$HOME/bin/$ARCH if [[ ! -d $BIN ]]; then echo "ERROR: \$BIN not found ($BIN)" exit 1 fi LD_LIBRARY_PATH=$HOME/lib/$ARCH if [[ $(echo $ARCH|grep -c "HP-UXB") -gt 0 ]]; then export SHLIB_PATH=$HOME/lib/$ARCH:$SHLIB_PATH fi PLAT=$(uname -s) PERL=$HOME/tools/bin/$PLAT/perl if [[ ! -x $PERL ]]; then echo "ERROR: \$PERL not found ($PERL)" exit 1 fi export HOME ARCH BIN PLAT LD_LIBRARY_PATH IGNORE_NO_USER exec $PERL -x $0 $* #--------------------------------------------------------------------- +---------- #!/bin/perl # # perl code starts after this

In reply to win32 perl script when you don't know where perl is by jptxs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (8)
As of 2024-04-18 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found