I am trying to convert a variable to a string format so I can use java runsql utility to insert its value into a database later. The database needs the value to be in a char format, hence string.
This is a dumbed down version of my code so I can get to the heart of what I'm asking -
#!/bin/ksh -x
value1=2018-01-01
value2=2018-02-01
mystring=$value1,$value2
echo $mystring
stringify=${'value1'},${'value2'})
echo $stringify
What happens is I get no output for stringify or depending on how I switch up the arrangement of the symbols I get the literal string 'value1' or 'value2'.
What am I doing wrong? I feel like this is very simple, maybe I've just been staring at it too long, I dunno.
${'value1'}? What are they intended to do? Showing your expected output explicitly (My desired output is X, my actual output is Y) would make this question considerably easier to understand.mystringis a string.value1andvalue2contain strings. This code contains no non-string variables whatsoever -- so when you say "convert a variable to string format", it's not at all clear what you're asking for.