filenames with spaces seem to be handled properly.

This commit is contained in:
Louwrentius 2009-03-01 16:10:53 +00:00
parent f9c9736cf7
commit a3534970fc
1 changed files with 14 additions and 12 deletions

View File

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