shell用变量的值作为新的变量名

tips:使用eval

例如:

#!/bin/bash
news=publish_time
var=news
# 要获取到publish_time
publish_time=`eval echo '$'"$var"`
echo $publish_time

原文地址:https://www.cnblogs.com/drunkPullBreeze/p/13373748.html