Project

General

Profile

Actions

$calias » History » Revision 3

« Previous | Revision 3/9 (diff) | Next »
Per Amundsen, 01/29/2017 11:11 PM


Added in 2.4

$calias

Returns the calling alias for the current script,

alias test1 {
  echo -ag Calling alias is $calias
  noop $test2
}

alias test2 {
  echo -ag Calling alias is still $calias
  noop $test3
}

alias test3 {
  echo -ag Calling alias is still $calias
}

Added in 2.7

$calias(N)

Returns the Nth alias in the scripting stack.

Parameters

N - The Nth alias.

Properties

.alias - Returns the name of the alias.
.fname - Returns the filename of the script containing the alias.
.line - Returns the line in the script containing the alias.
.isid - Returns $true if the alias was called as a identifier, otherwise $false.

Example

alias alias1 {
  alias2
}

alias alias2 {
  noop $alias3
}

alias alias3 {
  var %s 0
  while (%s < $calias(0)) {
    inc %s
    echo -ag alias = $calias(%s).alias
    echo -ag filename = $calias(%s).fname
    echo -ag line = $calias(%s).line
    echo -ag isid = $calias(%s).isid
  }
}

Updated by Per Amundsen about 7 years ago · 3 revisions

Also available in: PDF HTML TXT