3 ms·
POSIX shell is a Lisp-2. foo is a function (if in the first position of a command), otherwise just a "word": foo foo bar # look for foo function or command
by kazinator 6y ago
POSIX shell is a Lisp-2.
foo is a function (if in the first position of a command), otherwise just a "word":
foo foo bar # look for foo function or command, pass "foo" and "bar" arguments
The prefix $ must be used in any position in order to resolve a variable name.
$command $foo bar # substitute $command and $foo, then re-parse
A function foo and variable foo can co-exist:
foo=/usr/bin/foo
foo()
{
print $foo # no conflict
}
GNU Make is a Lisp-1, but needs a $(call F,X Y) operator to pass arguments to a macro F defined as F := <body> where in <body> the insertion of arguments is indicated using $(1), $(2), ... All the disadvantages of Lisp-1 with all the disadvantages of Lisp-2.