Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: execute perl script frm shell script

by Corion (Patriarch)
on Mar 28, 2006 at 06:53 UTC ( #539638=note: print w/replies, xml ) Need Help??

in reply to execute perl script frm shell script

My guess is that perl is correct about there not being a file in your directory. Possible causes for this are:

  • The current directory is not what you think it is. Print out the current directory before you start perl, maybe by doing cwd; before you launch Perl.
  • The file looks like it has the name but really it doesn't. Maybe it is called (note the lower-case "s"), or (note the letter ell instead of the digit one) or something like that.

But without knowing the setup, it's hard to tell. In my shell scripts, I always ensure that the current working directory is set to something sane by doing:

BASE=$(cd $(dirname $0);pwd)

This sets the shell variable $BASE to the directory where the script resides in. All other executions are then done relative to $BASE - in your case, I would use:

exec perl -w "$BASE/" "$@"

to launch the Perl script - maybe your stanza is better as it will preserve quotes - on my system, I don't have to fight with arguments with embedded whitespace.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://539638]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2022-09-25 14:52 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (116 votes). Check out past polls.