$~ » History » Version 2
Paul Janson, 03/08/2021 11:06 AM
1 | 1 | Per Amundsen | _Added in 1.9.2_ |
---|---|---|---|
2 | |||
3 | *$~[identifier]* |
||
4 | |||
5 | 2 | Paul Janson | A identifier prefixed with "~" executes normally if the identifier exists, and otherwise returns $null without generating a missing identifier warning if that's enabled. This also ensures that it cannot execute a custom alias of that same name. |
6 | |||
7 | <pre>//echo -a $ticksqpc and $~ticksqpc</pre> |
||
8 | |||
9 | In this example, the 1st $ticksqpc executes the built-in identifier if the script runs in a version new enough to contain that identifier. In older versions, it could execute a custom alias if it exists as that name, and otherwise would either return $null or trigger the optional identifier warning. |
||
10 | |||
11 | The 2nd $~ticksqpc never executes a a custom alias, and either executes a built-in identifier existing by that name, or in too-old versions returns $null without triggering the optional identifier warning. |