mIRC Home    About    Download    Register    News    Help

Print Thread
#103934 27/11/04 04:08 PM
Joined: Jul 2004
Posts: 31
H
hmtX Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Jul 2004
Posts: 31
$* used in an unusual environment:

Code:
ALIAS _yeh_ {
  TOKENIZE 32 ABC BCD | WHILE ( $* ) {
    ECHO -a $V1
  }
}


results in an infinite loop. $V1 returns: `~$*
`~$*........................ confused

#103935 27/11/04 05:19 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
The infinite loop has nothing to do with $*.

alias _yeh_ tokenize 32 ABC DEF | while ($1) { echo -a $v1 } will also result in an infinite loop, that's normal since nothing is making the while condition fail.

$* isn't to be used like that, but more like this:

alias _ifmatch if ($1) echo -a $v1
alias _yeh_ tokenize 32 ABC DEF | _ifmatch $*

Or if you want to do something as simple as echoing,

//tokenize 32 ABC DEF | echo -a $*

$* will call the command where it is specified in, for each token. In our example, the aliases _ifmatch and echo get called twice, for each token, being ABC and DEF.


Gone.
#103936 28/11/04 08:18 PM
Joined: May 2003
Posts: 79
A
Babel fish
Offline
Babel fish
A
Joined: May 2003
Posts: 79
Keep in mind that $* replaces the while.


Link Copied to Clipboard