unshift_function
Table of Contents
# $EPIC: unshift_function.txt,v 1.2 2006/08/20 17:37:08 sthalik Exp $
Synopsis:
$unshift(<variable name> <word list>)
Technical:
- If the <variable name> argument is omitted the empty string is returned.
- If the <word list> argument is omitted the rvalue of $<variable name> is returned.
- If the value of $<variable name> is the empty string, then the value of $<variable name> is set to <word list>.
- If the value of $<variable name> is not the empty string, then the value of $<variable name> is set to <word list> plus a space plus the old value of $<variable name>.
- The new value of $<variable name> is returned.
- <variable name> must not be prefixed with a $.
Practical:
Whereas the “shift” operation removes the first word from a word list (or variable), the “unshift” operation prepends words to the beginning of a word list in a variable and assigns the result back to the variable.
Returns:
The new value of $<variable name> after the unshift.
Examples:
assign -foo $unshift(foo blah) assigns "blah" to $foo and returns "blah" $unshift(foo booya) prepends "booya " to $foo and returns "booya blah"
unshift_function.txt · Last modified: 2006/08/29 16:08 by 127.0.0.1