我试图插入 3 个变量来构建路径,但无法获取它。
我正在尝试以下
log_path="/vol02/logs/$dname/logs/103602_$msname/${msname}_start.log"
dname=cfp
msname=cfp003
我得到以下输出。
_start.logs/cfp/logs/103602_cfp003
我需要
/vol02/logs/cfp/logs/103602_cfp003/cfp003_start.log
答案1
尝试这个:
dname=cfp
msname=cfp003
log_path="/vol02/logs/${dname}/logs/103602_${msname}/${msname}_start.log"
echo "$log_path"
输出:
/vol02/logs/cfp/logs/103602_cfp003/cfp003_start.log