I have the following:echo PLATFORM = $PLATFORMDATE_STRING=`date +20%y-%m-%d`echo DATE_STRING = $DATE_STRING# VERSION_LINE will be something like: '#define VERSION_STRING 1.2p2'VERSION_LINE=`grep ^#define VERSION_STRING ../version.hpp`#  - awk pulls the 1.2p2#  - tr deletes the surrounding quotesVERSION_STRING=`echo $VERSION_LINE | awk '{ print $3 }' | tr -d ''`echo VERSION_STRING = $VERSION_STRINGecho ####### Creating Archive ###########BINARY_FILE=build${PLATFORM}-${VERSION_STRING}-${DATE_STRING}_CLXXXXXXXX.zipecho BINARY_FILE is $BINARY_FILEThe output isPLATFORM = Linux64DATE_STRING = 2015-10-31VERSION_STRING = 1.2p2####### Creating Archive ###########-2015-10-31_CLXXXXXXXX.zip4-1.2p2All the inputs to the expansion of BINARY_FILE look right to me, but the result is mucked up. I've run into this several years ago, but can never recall what causes it. Any ideas? Thanks!
Bash String Expansion Corrupt
bash;string
There is almost definitely something non-printable in there mucking about with the terminal display, and I have a hunch it is a \return character fetched out of ../version.hpp by grep into $VERSION_LINE and from thence by awk into $VERSION_STRING. I could be wrong, but you should run:./yourscript | sed -n l...to get a feel for whatever it is. By the way, it could very well be echo screwing with your output as well. A UNIX-standards-compliant echo will interpret C-style escapes in its arguments.