从在bash变量国米preting命令替换 [英] Interpreting command substitution from a variable in bash

查看:195
本文介绍了从在bash变量国米preting命令替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关FOO的以下值:

$ FOO='echo `echo hello`'
$ $FOO
`echo hello`

我如何能得到预期的输出:

how can I get the expected output:

hello

基本上,我怎么能跨preT在一个变量的内容的命令替换?

Basically, how can I interpret a command substitution in the contents of a variable?

推荐答案

回答这个问题给出,

eval $FOO

但你很可能会约你的现实问题的错误的方式。

but you're probably going about your real problem the wrong way.

这篇关于从在bash变量国米preting命令替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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