参数扩展可以嵌套在Bash中吗? [英] Can parameter expansion be nested in Bash?

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

问题描述

可能重复:
可以将$ {var}参数扩展表达式嵌套在bash中吗?

Possible Duplicate:
Can ${var} parameter expansion expressions be nested in bash?

是否可以嵌套shell参数扩展(${})?

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}

推荐答案

据我所知,无法嵌套shell参数扩展.恐怕您将不得不找出实现所需需求的另一种方法.如果您发布代码,也许我们可以为您提供帮助.

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.

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

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