J
John
Hi,
One other Q for tonite. I just realised a little nuisance...
My shell script does some things and when it finds a particular file it
calls a perl script [from within the shell script] like this:
change.pl . myfile.txt << 2 command line parameters, a directory [DOT] and
a filename
I wanted . to reflect the working directory of the file that that needs to
be edited. Since my shell script has already descended into the file's
directory then there is no need to pass any other directory to the perl
script. Hence, I wanted to use . [DOT] as I don't really want to change the
directories at this point.
But my perl script dies due to the following line in its contents:
chdir '$ARGV[0]' || die "Cannot chdir to: $!\n";
On the other hand, if I want to run the perl script on its own, I need to be
able to give it some sort of a directory - hence the $ARGV[0].
If I remove the DIE option both scripts run together as expected. Am I doing
something wrong? Why is the perl script unable to chdir '.'?
Thank you.
One other Q for tonite. I just realised a little nuisance...
My shell script does some things and when it finds a particular file it
calls a perl script [from within the shell script] like this:
change.pl . myfile.txt << 2 command line parameters, a directory [DOT] and
a filename
I wanted . to reflect the working directory of the file that that needs to
be edited. Since my shell script has already descended into the file's
directory then there is no need to pass any other directory to the perl
script. Hence, I wanted to use . [DOT] as I don't really want to change the
directories at this point.
But my perl script dies due to the following line in its contents:
chdir '$ARGV[0]' || die "Cannot chdir to: $!\n";
On the other hand, if I want to run the perl script on its own, I need to be
able to give it some sort of a directory - hence the $ARGV[0].
If I remove the DIE option both scripts run together as expected. Am I doing
something wrong? Why is the perl script unable to chdir '.'?
Thank you.