http://www.perlmonks.org?node_id=539638


in reply to execute perl script frm shell script

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

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/Script1.pl" "$@"

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.