/圧縮の問題

/圧縮の問題

ソフトウェアによって提供されるいくつかのスクリプトがあります。スクリプト出力は次のようになります(デバッグモードで)。

+ changeDirectory
+ '[' -d /cdr/work/proc_raw/proc ']'
+ cd /cdr/work/proc_raw/proc
+ echo 'Changed to the directory: /cdr/work/proc_raw/proc'
Changed to the directory: /cdr/work/proc_raw/proc
+ retypeFileName
++ echo ''\''*.old'\'''
++ sed 's/'\''//g'
+ FILE='*.old'
+ case $TYPE in
+ compressFiles
+ echo 'files to compress: '
files to compress: 
+ find . -name '*.old' -mtime +3
./file1.cdr.old
./file2.cdr.old
...
+ find . -name '*.old' -mtime +3
+ xargs compress -f
+ ecode=0
+ '[' 0 -gt 0 ']'
+ echo 'executed: find . -name *.old -mtime +3 | xargs compress -f'

ただし、後でそのディレクトリでfile1.cdr.old.Z、file1.cdr.old.Z、..を検索してみると、そのファイルは存在しません。

file次のコマンドを実行すると、圧縮が失敗する理由がないようです。

-bash-3.2# file file1.cdr.old
file1.cdr.old: ASCII text, with very long lines

どんな提案がありますか?

編集:スクリプトの関連部分:

# Change to the selected directory
changeDirectory (){
    if [ -d $DIRECTORY ]
    then
    cd $DIRECTORY
    echo "Changed to the directory: $DIRECTORY" >> $LOGFILE
    else
        echo "$DIRECTORY does not exists" >> $LOGFILE
        exit 1
    fi
}

# Removes the "'" characters from filename.
retypeFileName (){
   FILE=$(echo $FILE | sed s/"'"//g )
}
# COMPRESSING FILES
compressFiles () {
   echo "files to compress: " >> $LOGFILE
   find . -name "$FILE" -type f $ACTION_TYPE +$PARAM >> $LOGFILE

   find . -name "$FILE" -type f $ACTION_TYPE +$PARAM | xargs compress -f
   ecode=$?

    if [ $ecode -gt 0 ]
    then
        dt=`date "+%Y-%b-%d %H:%M:%S"`
        echo "$dt > ERROR while compressing files. Error Code was $ecode" >> $LOGFILE
        exit 2
    fi

    echo "executed: find . -name "$FILE" -type f $ACTION_TYPE +$PARAM | xargs compress -f" >> $LOGFILE
}

ベストアンサー1

おすすめ記事