$scriptline

From Scriptwiki
Revision as of 20:57, 6 April 2008 by Albie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Returns line number in current script.

$scriptline

Example

alias SecureMinus {
  if ($1 !isnum) echo -ag Error on line $scriptline $!1 isn't a number. 
  if ($2 !isnum) echo -ag Error on line $scriptline $!2 isn't a number. 
  if ($2 > $1) echo -ag Error on line $scriptline $!2 is greater than $!1
  if ($3 != MyPassword) echo -ag Incorrect password on line $scriptline
  else echo -ag $calc($1 - $2)
}

In the above alias if $1 or $2 is not a number, or $2 is greater than $1 or $3 does not equal MyPassword, it lets you know what line in the script file where it has failed.

See Also

  • $script Remote script currently being executed.