You are not logged in.

#1 2008-10-13 16:36:09

fflarex
Member
Registered: 2007-09-15
Posts: 466

does bash have anything like lambda?

I want to define and call a function without saving it for later. Is this possible in bash?

If not, can anyone think of a way to write it?

Offline

#2 2008-10-13 17:51:44

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: does bash have anything like lambda?

function foo {
    echo "doing foo stuff"
}
foo arg1 arg2 arg3
unset -f foo
# now foo is no longer defined

Offline

#3 2008-10-13 18:15:49

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: does bash have anything like lambda?

And to get a more lambda-like feel:
eval "function foo { echo 'doing foo stuff'; }"
foo
unset -f foo

Offline

Board footer

Powered by FluxBB