Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: How to set (environment) variables for the script

by Skeeve (Vicar)
on Jun 10, 2010 at 14:58 UTC ( #844016=note: print w/replies, xml ) Need Help??

in reply to How to set (environment) variables for the script

This gave me the cleanest solution, I guess: perldoc perlrun

My script starts now like this:

#!/bin/sh mydir=`dirname $0` . $mydir/ exec perl -x $0 "$@" #!perl use strict; use warnings; # and so on...

Thanks to all who replied!

Update: In reply to Arge1 below and because I noticed today That I myself needed parameters to my script.

I appended "$@" to my exec above. This will append all parameters, individually quoted, to the exec command for my perl script to handle them.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://844016]
[karlgoethebier]: Discipulus: Corion may be right... backslash?
[karlgoethebier]: Discipulus: i don't know. no msdog at hand no more
[Eily]: Discipulus I get the same thing on strawberry perl v5.20
[Eily]: hu, it came with 5.22 ...
Discipulus win32 is the vietnam of envs..

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-07-21 08:35 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (319 votes). Check out past polls.