Quantcast
Channel: Take Command / TCC
Viewing all articles
Browse latest Browse all 1678

An alias whose action depends on the name used to invoke it

$
0
0
I never thought of doing this until today. It works. I must now think of a use for it.

Code:
v:\> alias z*ero `echo %@repeat[0,%@len[%0]]`

v:\> z
0

v:\> ze
00

v:\> zer
000

v:\> zero
0000

A more typical use might be something like this.

Code:
v:\> alias x*y `if %0 == x (echo foo) else (echo bar)`

v:\> x
foo

v:\> xy
bar

Viewing all articles
Browse latest Browse all 1678

Trending Articles