Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concat variables in Heredoc

I have the following KornShell (ksh) script:

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

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

Howerver, this gives me only (because the variable $VARfoldername is evaluated, which apparently does not exist):

01_01_2014

I need to concat $VAR with another string and then with $DAT, such that running the script results in:

/this/is/a/path/foldername01_01_2014
like image 682
Kiril Avatar asked Oct 01 '13 15:10

Kiril


1 Answers

shell has just the syntax for you:

${VAR}foldername${DAT}

IHTH

like image 86
shellter Avatar answered Oct 26 '22 21:10

shellter