【问题标题】:Concat variables in HeredocHeredoc中的Concat变量
【发布时间】:2013-10-07 20:11:54
【问题描述】:

我有以下 KornShell (ksh) 脚本:

VAR='/this/is/a/path/'
DAT='01_01_2014'

cat << EOF
... what should I do here to concat variables with strings? ...
$VARfoldername$DAT
EOF

但是,这只是给我(因为变量 $VARfoldername 被评估,显然不存在):

01_01_2014

我需要将 $VAR 与另一个字符串连接,然后与 $DAT 连接,这样运行脚本会导致:

/this/is/a/path/foldername01_01_2014

【问题讨论】:

    标签: string shell variables concatenation ksh


    【解决方案1】:

    shell 有适合你的语法:

    ${VAR}foldername${DAT}
    

    IHTH

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-06
      • 2019-03-05
      • 2017-06-03
      • 1970-01-01
      • 2011-07-16
      • 2012-04-19
      • 1970-01-01
      相关资源
      最近更新 更多