在shell脚本匿名函数 [英] Anonymous functions in shell scripts

查看:224
本文介绍了在shell脚本匿名函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能创建一个匿名函数,其值可以分配到一个数组元素,后来被称为类似的东西?我似乎无法找到一种方法,在bash脚本要做到这一点,但也许有一个变通方法。

Is it possible to create something analogous to an anonymous function whose value can be assigned to an array element and later called? I can't seem to find a way to do this in a bash script but perhaps there's a workaround.

推荐答案

简短的回答:没有。

龙答:Nooooooooooooo

Long answer: Nooooooooooooo.

完整的答案:在bash函数不是第一类对象,所以不可能有这样的事情在bash一个匿名函数

Complete answer: Functions in bash are not first-class objects, therefore there can be no such thing as an anonymous function in bash.

这篇关于在shell脚本匿名函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆