Project

General

Profile

$calias » History » Version 3

Per Amundsen, 01/29/2017 11:11 PM

1 1 Per Amundsen
_Added in 2.4_
2
3
*$calias*
4
5
Returns the calling alias for the current script,
6
7
<pre>
8
alias test1 {
9
  echo -ag Calling alias is $calias
10
  noop $test2
11
}
12
13
alias test2 {
14
  echo -ag Calling alias is still $calias
15
  noop $test3
16
}
17
18
alias test3 {
19
  echo -ag Calling alias is still $calias
20
}
21
</pre>
22 2 Per Amundsen
23
---
24
25
_Added in 2.7_
26
27
*$calias(N)*
28
29 3 Per Amundsen
Returns the Nth alias in the scripting stack.
30 2 Per Amundsen
31
*Parameters*
32
33 3 Per Amundsen
N - The Nth alias.
34 2 Per Amundsen
35
*Properties*
36
37 3 Per Amundsen
.alias - Returns the name of the alias.
38
.fname - Returns the filename of the script containing the alias.
39
.line - Returns the line in the script containing the alias.
40 2 Per Amundsen
.isid - Returns [[$true]] if the alias was called as a identifier, otherwise [[$false]].
41
42
*Example*
43
44
<pre>
45
alias alias1 {
46
  alias2
47
}
48
49
alias alias2 {
50
  noop $alias3
51
}
52
53
alias alias3 {
54
  var %s 0
55
  while (%s < $calias(0)) {
56
    inc %s
57
    echo -ag alias = $calias(%s).alias
58
    echo -ag filename = $calias(%s).fname
59
    echo -ag line = $calias(%s).line
60
    echo -ag isid = $calias(%s).isid
61
  }
62
}
63
</pre>