Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的事情:
$CORSAIR_TYPE="good" $CASE="CORSAIR" ... $local temp_type=${CASE}_TYPE echo ${!temp_type}
这给了我变量的值CORSAIR_TYPE,它是“好”的。有没有办法在不创建temp_type变量的情况下做到这一点?我会用什么代替echo ${!temp_type}?
CORSAIR_TYPE
temp_type
echo ${!temp_type}
谢谢
对于其他偶然发现这篇文章的人,这是我发现的一种方法:
echo $(eval echo $`echo ${CASE}_TYPE`)