【发布时间】:2021-02-24 21:52:13
【问题描述】:
我在bash 中有一小段代码
# below variable coming from a source file
test_name_tgt_tbl='abc_123'
# this variable coming from another source --> source 2
red_test='test_name'
# Based on source2 variable I need to find value in source 1
out_put=`echo ${red_test}_tgt_tbl`
echo "target=`echo $out_put`"
我得到的结果如下
target=test_name_tgt_tbl
我想要的结果如下
target=abc_123
我怎样才能做到这一点
【问题讨论】:
-
foo=`echo $bar` 是写
foo=$bar的一种非常糟糕的方式,顺便说一句。