I have the following:
echo "PLATFORM = $PLATFORM"
DATE_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 quotes
VERSION_STRING=`echo "$VERSION_LINE" | awk '{ print $3 }' | tr -d '"'`
echo "VERSION_STRING = $VERSION_STRING"
echo "####### Creating Archive ###########"
BINARY_FILE="build${PLATFORM}-${VERSION_STRING}-${DATE_STRING}_CLXXXXXXXX.zip"
echo "BINARY_FILE is $BINARY_FILE"
The output is
PLATFORM = Linux64
DATE_STRING = 2015-10-31
VERSION_STRING = 1.2p2
####### Creating Archive ###########
-2015-10-31_CLXXXXXXXX.zip4-1.2p2
All 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!
$VERSION_LINE
pulled out of.hpp
bygrep
. run./yourscript | sed -n l
– mikeserv Oct 31 '15 at 21:13\r
eturn at the end of the line? is the field at the end of the line? even if im wrong about where it comes from or what it is, there is almost definitely something non-printable in there mucking about with the terminal display. run that command above to get a feel for what it is. by the way, it could very well beecho
screwing with your output as well. a UNIX-standards-compliantecho
will interpret C-style escapes in its arguments. – mikeserv Oct 31 '15 at 21:25