mpersico has asked for the wisdom of the Perl Monks concerning the following question:
The idea is to get the parent of the process. Other code is checking for other conditions. But that's not the problem. The problem is that $F[4] only works on some 'ps'. For the 'ps' in Cygwin, I need to use $F[1]. Sooooo, I naively tried this:pid=$(ps -l -p $pid | grep -v PPID | perl -ane 'print $F[4]')
which resulted inppidi=4 [ $(uname) = 'Cygwin ] && ppidi=1 ... pid=$(ps -l -p $pid | grep -v PPID | \ perl -ane 'print $F[$ARGV[0]]' $ppidi);
In short, once you use -n or -p, there is no way to use ARGV as arguments, and not have them sucked up as filenames to feed to the virtual while(<>) {} loop, is there?Can't open 1: No such file or directory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: -n and -p suck up ARGV no matter what
by tybalt89 (Monsignor) on Oct 21, 2016 at 21:04 UTC | |
by mpersico (Monk) on Oct 22, 2016 at 03:01 UTC | |
|
Re: -n and -p suck up ARGV no matter what
by stevieb (Canon) on Oct 21, 2016 at 20:44 UTC | |
|
Re: -n and -p suck up ARGV no matter what
by mpersico (Monk) on Oct 21, 2016 at 20:41 UTC |