diff options
author | Geert Hauwaerts <geert@hauwaerts.be> | 2014-06-30 21:21:22 +0200 |
---|---|---|
committer | Geert Hauwaerts <geert@hauwaerts.be> | 2014-06-30 21:21:22 +0200 |
commit | b68c168f94e8c9b5f45ab9430ffae064fefd5c9c (patch) | |
tree | bb0408d8682910a2616991d30ebb3bf3792fcb36 | |
parent | 2e6f16c0faf345245c5a224de529827a51203d1c (diff) | |
parent | 70e49f673e75d529123dde4a977534fcbabe3046 (diff) | |
download | irssi-b68c168f94e8c9b5f45ab9430ffae064fefd5c9c.zip |
Merge pull request #76 from ailin-nemui/improve-special-vars
Improve docs of special_vars wrt. to escaping rules in /alias
-rw-r--r-- | docs/special_vars.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/special_vars.txt b/docs/special_vars.txt index f19b2bb2..36517f78 100644 --- a/docs/special_vars.txt +++ b/docs/special_vars.txt @@ -114,3 +114,19 @@ surrounding text will not affect the expression's return value. /eval echo foo${N}foo /* ${N} returns current nickname */ fooYourNickfoo /* returned by above command */ +When writing an alias containing a /script exec, special consideration has to be +taken to $vars and statement delimiters, ie. ; +/alias tries to evaluate all $vars as expandos, which would mean that what you +pass on to /script exec isn't necessarily what you intended. +Compare: + + 1. /alias al1 script exec my $var = "Hello"; print $var; + 2. /alias al2 script exec my $$var = "Hello"\; print $$var; + 3. /alias al3 script exec my \$var = "Hello"\; print \$var; (Same as nr 2) + +In example nr 1 $var would be expanded to an empty string and ; would end +the /script exec command, leaving print $var as a separate command to be run by +irssi. In example 2 $$ is evaluated to a literal $ leaving a literal $var to be +passed on to /script exec. The same goes for \; which is turned into a +literal ; and thus is passed on to /script exec as a statement delimiter. +This would mean print $$var is part of the /script exec being evaluated. |