append 482 B

123456789101112131415161718
  1. #APPE $FISH_FILESIZE $FISH_FILENAME
  2. echo "### 001"
  3. FILENAME="/$FISH_FILENAME"
  4. res=`exec 3>&1
  5. (
  6. head -c $FISH_FILESIZE -q - || echo DD >&3
  7. ) 2>/dev/null | (
  8. cat > "${FILENAME}"
  9. cat > /dev/null
  10. )`; [ "$res" = DD ] && {
  11. > "${FILENAME}"
  12. while [ $FISH_FILESIZE -gt 0 ]
  13. do
  14. cnt=`expr \\( $FISH_FILESIZE + 255 \\) / 256`
  15. n=`dd bs=256 count=$cnt | tee -a "${FILENAME}" | wc -c`
  16. FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
  17. done
  18. }; echo "### 200"