Well, that would explain it then. (So $$ isn't actually an environment
variable, it just looks like one? I had my threads calling a seperate
function...)
> To get what you are describing it is
> necessary to "sh -c 'echo $$'" to force the delay of evaluation.
Except that this spawns a new child and gives me the PID of the child, which
lives for maybe a tenth of a second...
Maybe I could do something with eval...?
Either way, I switched the project in question to python.
> That depends on what you are trying to do.
A couple people emailed me and pointed out I had to set IFS=$'\n', (often
after first saying "there's no way to do that" and then correcting themselves
towards the end of the message...)
My first attempt to do it was to pipe the data into a sub-function do read a
line at a time and store the results in an array. (Seemed pretty
straightforward.)
Except there's no way to get that array back out of the function, and that IS
documented at the end of the bash man page.
As I said: Python.
> Are you trying to echo the
> entire "ls -l"? or are you trying to convert an "ls -l" into a single
> column based on a field extracted from "ls -l".
I was trying to convert the lines into an array I could then iterate through.
> If the fields don't matter, but you want each line processed in the
> loop do:
>
> ls -l | while read i
> do
> echo line:$i
> done
Hmmm... If that avoids the need to export the array from one shell instance
to another, maybe it'd work. (I'm not really doing echo, I was doing
var[$i]="line", with some other misc stuff.)
But I got it to work via IFS, and that's good enough for right now.
> If you want such elaborate handling of strings, I suggest using perl.
I came to the same conclusion, but would like for more than one person to be
able to work on the same piece of code, so it's python. (Or PHP if Carl's
the one who gets around to porting it first. :) But in the meantime, the
shell script is now working. Thanks everybody...)
Back to talking about the kernel.:)
Rob
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/