filenames with spaces seem to be handled properly.

This commit is contained in:
Louwrentius 2009-03-01 16:10:53 +00:00
parent aa15c6f868
commit 66a8983a3e

24
ppss.sh
View File

@ -976,7 +976,7 @@ commando () {
ITEM="$PPSS_LOCAL_TMPDIR/$ITEM" ITEM="$PPSS_LOCAL_TMPDIR/$ITEM"
fi fi
LOG_FILE_NAME=`echo $ITEM | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g` LOG_FILE_NAME=`echo "$ITEM" | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g`
ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME" ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME"
does_file_exist "$ITEM_LOG_FILE" does_file_exist "$ITEM_LOG_FILE"
@ -984,24 +984,26 @@ commando () {
then then
log DEBUG "Skipping item $ITEM - already processed." log DEBUG "Skipping item $ITEM - already processed."
else else
echo "HOST = $HOSTNAME" > "$ITEM_LOG_FILE"
TMP=`echo $COMMAND | grep -i "%ITEM%"` ERROR=""
TMP=`echo $COMMAND | grep -i '$ITEM'`
if [ "$?" == "0" ] if [ "$?" == "0" ]
then then
echo "ITEM IS $ITEM" echo "=================" > "$ITEM_LOG_FILE"
ESCAPED=`echo $ITEM | sed -e s:\\\\\/:\\\\\\\\/:g` echo "HOST = $HOSTNAME" >> "$ITEM_LOG_FILE"
echo "ESCAPED is $ESCAPED" echo "ITEM = $ITEM" >> "$ITEM_LOG_FILE"
COMMAND=`echo $COMMAND | sed -e s:%ITEM%:$ESCAPED:g` ##ESCAPED=`echo "$ITEM" | sed -e s:\\\\\/:\\\\\\\\/:g`
echo "COMMAND = $COMMAND" #COMMAND=`echo $COMMAND | sed -e s:%ITEM%:"$ESCAPED":g`
EXECME='$COMMAND >> "$ITEM_LOG_FILE" 2>&1' #echo "COMMAND is $COMMAND" >> "$ITEM_LOG_FILE"
echo EXECME is "$EXECME"
eval "$COMMAND" >> "$ITEM_LOG_FILE" 2>&1
ERROR="$?"
else else
EXECME='$COMMAND"$ITEM" >> "$ITEM_LOG_FILE" 2>&1' EXECME='$COMMAND"$ITEM" >> "$ITEM_LOG_FILE" 2>&1'
echo EXECME is "$EXECME" echo EXECME is "$EXECME"
fi
eval "$EXECME" eval "$EXECME"
ERROR="$?" ERROR="$?"
fi
if [ ! "$ERROR" == "0" ] && [ "$TRANSFER_TO_SLAVE" == "1" ] if [ ! "$ERROR" == "0" ] && [ "$TRANSFER_TO_SLAVE" == "1" ]
then then