sub get_login_env {
local %ENV;
my $csh = shift;
my $env = `$csh ; env`;
if (wantarray) {
my @pieces = ($env =~ m/^(.*?)=((?:[^\n\\]|\\.|\\\n)*)/gm);
s/\\(.)/$1/g foreach @pieces;
return @pieces;
}
else {
return $env;
}
}
| [reply] [d/l] |
hello folks, i want to execute run_dynamic.csh file from my perl script. also my cshell file consist of environment variables command like setenv. i tried system("csh","file pointer"); but not working. please throw some light on it. thanks, argha
From your very verbose and informative posting, it is absolutely clear that the error is in line 42.
If you want serious answers, show some efforts in your postings:
- relevant code
- error messages
- actual output
- expected output
- all unmodified except for passwords and other sensitive data
- all copied from actual files / output, not typed manually
- each wrapped in <code></code>
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] |
system("csh", "-c", $cmd); | [reply] [d/l] |
You should definitely read Csh programming considered harmful and then decide whether to use a Bourne-like shell instead or (better) to convert the whole thing to Perl thus avoiding the fork, the shell invocation, the parent problem, FD changes, output/error grabbing, etc.
| [reply] |