Answer the question
In order to leave comments, you need to log in
How to do in bash?
Essence: there is a file in which in each line is the name of the directory that needs to be deployed.
Everything would be nothing if it were not for the newline character \r
rm -rf proxy-services
source ~/load_env.sh
SVNROOT=http://flink/svn2/mw/projects/services/ESB-Int/branches/proxy-services/
mkdir -p proxy-services
cd proxy-services
for BRANCH in `svn ls $SVNROOT --depth immediates | sed 's:/*$::'`;
do
if svn info $SVNROOT/$BRANCH/ci.txt 1>/dev/null 2>&1 ;
then
echo "File ci.txt found in $BRANCH branch..."
echo "Fetching $BRANCH..."
svn co $SVNROOT/$BRANCH
cd $BRANCH
for LINE in `cat ci.txt`;
do
if [ -d `$LINE | sed 's/\\r//g'` ]; # тут все отрабатывает как надо, директория находится
then
echo "---- Now trying to deploy $LINE from $BRANCH..." # попытки отбросить \r вот тут
ant -buildfile ../../build4.xml -Ddeploy.type=kwsesbapu07 -Dproxy=$LINE -Dbranch=$BRANCH hdeploy-proxy # и вот тут миллионом разных способов ни к чему не привели
cd ..
fi
done
fi
done
Answer the question
In order to leave comments, you need to log in
\r is a carriage return, not a line feed.
1. Are you sure you want to remove \r, not \n ?
2. Try before "for LINE in `cat ci.txt`;" run:
dos2unix cat ci.txt
3. You can "if [ -d `$LINE | sed 's/\\r//g'` ];" replaced by
$LINE=`echo "$LINE" | tr -d "\r"`
if [ -d $LINE ];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question