mIRC Home    About    Download    Register    News    Help

Print Thread
#209678 20/02/09 07:19 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
Hi

about $*
when i use it with $+ i don't have the expected result

Code:
alias t {
  tokenize 32 1 2 3 4 5 6
  echo -a - $* $+(test,$*)
}

return

- 1 test`~$*
- 2 test`~$*
- 3 test`~$*
- 4 test`~$*
- 5 test`~$*
- 6 test`~$*

normally it is supposed to return

- 1 test1
- 2 test2
- 3 test3
- 4 test4
- 5 test5
- 6 test6

can you fix this problem plz

and more

Code:
alias x {
  tokenize 32 1 2 3 4 5 6
  echo -a - $* $+(test,$*) $*
  echo -a blabla
  echo -a $*
  echo -a bloblo
}


return

- 1 test`~$* 1
- 2 test`~$* 2
- 3 test`~$* 3
- 4 test`~$* 4
- 5 test`~$* 5
- 6 test`~$* 6
blabla
bloblo

the second $* doesnt work anymore!! smirk


WorldDMT
chacha #209679 20/02/09 07:39 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Please have a look at this thread.

chacha #209680 20/02/09 08:13 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
The answer in your specific case is that $* can only be used once per command since each $* does its own iteration. As Khaled said in the referenced thread, $* is no longer supported for specific issues like these and therefore its behaviour is not going to change.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #210314 11/03/09 01:57 PM
Joined: Dec 2007
Posts: 48
K
Kol Offline
Ameglian cow
Offline
Ameglian cow
K
Joined: Dec 2007
Posts: 48
Actually it's because of what Chessnut said in that thread.

Code:
echo -a - $* $+(test,$*)


becomes

Code:
echo -a - `~$* $+(test,`~$*)


`~$* has to be a space delimited token for mIRC to convert it to the corresponding token so you end with:

Code:
echo -a - 1 test`~$*


(for the first iteration)

As Chessnut stated, a way around it would be:

Code:
scon -r echo -a - $* $!+(test, $* )


to ensure that $* evaluates with spaces surrounding it.


Link Copied to Clipboard