1 |
On Thu, 2007-10-04 at 11:53 +0200, Marijn Schouten (hkBst) wrote: |
2 |
> > See, another use of bash arrays just because you can? |
3 |
> > IFS=- |
4 |
> > set -- ${CHOST} |
5 |
> > spec=$2 |
6 |
> > |
7 |
> > Works fine in bash - and other shells. |
8 |
> |
9 |
> Do I understand correctly that this resets any arguments that might have been |
10 |
> passed to the function this happens to be in? |
11 |
|
12 |
Yes it does. |
13 |
|
14 |
Most people write their functions like so |
15 |
|
16 |
foo() { |
17 |
local this=$1 that=$2 |
18 |
|
19 |
And then use $this and $that for greater clarity. So if they do that |
20 |
then resetting the positional parameters is a non issue as they've |
21 |
already been saved. |
22 |
|
23 |
Thanks |
24 |
|
25 |
Roy |
26 |
|
27 |
-- |
28 |
gentoo-dev@g.o mailing list |