0

I am trying to append timestamp in a string(which is my file name) and storing in a variable which will be passed as a parameter to another script. While executing the script i can see that filename is passed without underscore. Could you please help me to get the output with underscore?

Syntax am using

Filename="CLASS_10_STUDENT_DATA_"$timestamp
echo $Filename

Output which i got while running the script is -

CLASS 10 STUDENT DATA 2020101109876

Expected Output is -

CLASS_10_STUDENT_DATA_2020101109876
John Kugelman
  • 330,190
  • 66
  • 504
  • 555
  • 5
    Did you change `IFS`? That can cause weird effects like this. In any case, It's a good idea to double-quote the variable reference. See ["I just assigned a variable, but `echo $variable` shows something else"](https://stackoverflow.com/questions/29378566/i-just-assigned-a-variable-but-echo-variable-shows-something-else) and ["When should I wrap quotes around a shell variable?"](https://stackoverflow.com/questions/10067266/when-to-wrap-quotes-around-a-shell-variable) (hint: almost always). Also: use [shellcheck.net](https://www.shellcheck.net). – Gordon Davisson Oct 22 '21 at 10:09

0 Answers0