嵌套壳牌参数扩展 [英] Nested Shell Parameter Expansion

查看:82
本文介绍了嵌套壳牌参数扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  可以$ {VAR}的前pressions被嵌套在bash ?

是否有可能窝壳参数扩展($ {})?

Is it possible to nest the shell parameter expansion (${})?

如果我想要做这样的事情:

If I want to do something like this:

foo=( 1 2 3 4 5 )
echo ${${foo[@]/3/bar}:1}

极坏的榜样,我知道了。

Very bad example, I know.

推荐答案

据我所知,这是不可能的窝壳参数扩展。恐怕你得弄清楚实现你所需要的另一种方式。如果您发布code,也许我们可以帮你。

As far as I know, it is not possible to nest shell parameter expansion. I'm afraid you'll have to figure out another way of achieving what you need. If you post the code, maybe we can help you.

这篇关于嵌套壳牌参数扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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