$$N behaviour - 14/09/05 12:53 AM
Consider this example:
alias test_1 echo -a $$1
alias test_2 {
test_1
echo -a -> hmm
}
When issuing /test_2 nothing will happen. This is because no parameter is specified when calling the alias test_1 inside the second alias. However, I feel that using $$ should only stop the alias from processing which holds the $$, in this case test_1.
I think test_1 should not execute (as always when specifying $$N), however test_2 should keep going, in this example echoing "-> hmm".
I'm not really sure if this is even intended behaviour, so I contemplated whether to post in the bug forum or this one. Basically the above two aliases should do the same as this does:
alias test_1 return
alias test_2 {
test_1
echo -a -> hmm
}
When test_2 is called, it first calls test_1 which immediately returns (as with the first example with $$1), however now it keeps going.
Changing the examples to work with return:
alias test_1 return $$1
alias test_2 {
echo -a -> $test_1
echo -a -> hmm
}
This will again not echo hmm, whilst I would prefer that it only stops processing if I specifically stated $$test_1, this gives me more control.
alias test_1 echo -a $$1
alias test_2 {
test_1
echo -a -> hmm
}
When issuing /test_2 nothing will happen. This is because no parameter is specified when calling the alias test_1 inside the second alias. However, I feel that using $$ should only stop the alias from processing which holds the $$, in this case test_1.
I think test_1 should not execute (as always when specifying $$N), however test_2 should keep going, in this example echoing "-> hmm".
I'm not really sure if this is even intended behaviour, so I contemplated whether to post in the bug forum or this one. Basically the above two aliases should do the same as this does:
alias test_1 return
alias test_2 {
test_1
echo -a -> hmm
}
When test_2 is called, it first calls test_1 which immediately returns (as with the first example with $$1), however now it keeps going.
Changing the examples to work with return:
alias test_1 return $$1
alias test_2 {
echo -a -> $test_1
echo -a -> hmm
}
This will again not echo hmm, whilst I would prefer that it only stops processing if I specifically stated $$test_1, this gives me more control.