Reputation: 1287
I'm building some sources, that have two legacy part - one windows-like, based on bunch of bat/cmd files, and other based on unix-like building system, with autools, makefiles, etc. So, to prevent massive rewrite of build system, cygwin bash called from bat file. And I'm need to use sources variable in buildscripts (LEGACY_SOURCE*). But if I setting up LEGACY_SOURCE_CYG with double quotes bash can't handle that as parameter.
build.bat:
set LEGACY_SOURCE="c:\some\path"
set LEGACY_SOURCE_CYG='c:\some\path'
rem -----------------------------------------------
rem Building library, using Makefile
rem -----------------------------------------------
bash -c "export LEGACY_SOURCE_CYG=%LEGACY_SOURCE_CYG%; export PATH_WATCOM=%PATH_WATCOM%; export PATH_JWASM=%PATH_JWASM%; exec build/buildlib.sh"
buildlib.sh
#!/bin/sh
echo "Building USB library..."
SRC=$(echo -E "${LEGACY_SOURCE_CYG}" | sed -e 's/^\(.\{1\}\)/\L\1/' -e 's,:,,' -e 's,\\,/,g')
SRC="/cygdrive/${SRC}"
So question is how to eliminate duplication of same path in double quotes, and ordinary quotes.
Upvotes: 0
Views: 76
Reputation: 70923
set LEGACY_SOURCE="c:\some\path"
set "LEGACY_SOURCE_CYG=%LEGACY_SOURCE:"='%"
Upvotes: 1