new-words

diff new-words.sh @ 6:d1851ee29a1a

minifix
author Igor Chubin <igor@chub.in>
date Wed Mar 10 10:38:27 2010 +0200 (2010-03-10)
parents c703b8898696
children 0ff259b8b6a3
line diff
     1.1 --- a/new-words.sh	Tue Mar 02 22:28:27 2010 +0200
     1.2 +++ b/new-words.sh	Wed Mar 10 10:38:27 2010 +0200
     1.3 @@ -18,6 +18,7 @@
     1.4  WORK_DIR=~/.new-words/
     1.5  TEMP1=`mktemp /tmp/news-words-XXXXXXXXXX`
     1.6  TEMP2=`mktemp /tmp/news-words-XXXXXXXXXX`
     1.7 +export ORIGINAL_TEXT=`mktemp /tmp/news-words-XXXXXXXXXX-orig`
     1.8  editor=${EDITOR:-vim}
     1.9  
    1.10  LANGUAGE=en
    1.11 @@ -195,12 +196,15 @@
    1.12  cd $WORK_DIR
    1.13  if echo "$1" | grep -q http: 
    1.14  then 
    1.15 -    text_from_url "$1" | get_words ${TEMP1}-full | add_stat ${TEMP1}-full| tee "$TEMP1" > "$TEMP2"
    1.16 +    text_from_url "$1" | tee $ORIGINAL_TEXT \
    1.17 +    | get_words ${TEMP1}-full | add_stat ${TEMP1}-full| tee "$TEMP1" > "$TEMP2"
    1.18  elif [ "$#" != 0 ]
    1.19  then
    1.20 -    cat "$1" | get_words ${TEMP1}-full | add_stat ${TEMP1}-full | tee "$TEMP1" > "$TEMP2"
    1.21 +    cat "$1" | tee $ORIGINAL_TEXT \
    1.22 +    | get_words ${TEMP1}-full | add_stat ${TEMP1}-full | tee "$TEMP1" > "$TEMP2"
    1.23  else 
    1.24 -    get_words ${TEMP1}-full| add_stat ${TEMP1}-full | tee "$TEMP1" > "$TEMP2"
    1.25 +    tee $ORIGINAL_TEXT \
    1.26 +    | get_words ${TEMP1}-full | add_stat ${TEMP1}-full | tee "$TEMP1" > "$TEMP2"
    1.27  fi
    1.28  
    1.29  add_marks "$TEMP2"
    1.30 @@ -214,4 +218,4 @@
    1.31  remove_marks "$TEMP2"
    1.32  
    1.33  diff "$TEMP1" "$TEMP2" | awk '{print $3}' | sort -u >> "$VOCABULARY"
    1.34 -rm -f "$TEMP1" "$TEMP2" "${TEMP1}-full"
    1.35 +rm -f "$TEMP1" "$TEMP2" "${TEMP1}-full" "$ORIGINAL_TEXT"