Project

General

Profile

$calias » History » Revision 3

Revision 2 (Per Amundsen, 01/29/2017 11:11 PM) → Revision 3/9 (Per Amundsen, 01/29/2017 11:11 PM)

_Added in 2.4_ 

 *$calias* 

 Returns the calling alias for the current script, 

 <pre> 
 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 
 } 
 </pre> 

 --- 

 _Added in 2.7_ 

 *$calias(N)* 

 Returns the Nth alias or identifier in the scripting stack. 

 *Parameters* 

 N - The Nth alias. alias or identifier. 

 *Properties* 

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

 *Example* 

 <pre> 
 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 
   } 
 } 
 </pre>