gollum.sh 555 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. #
  3. # "It isn't fair, my precious, is it,
  4. # to ask us what it's got in it's
  5. # nassty little pocketsess?"
  6. # Gollum, The Hobbit, or There and Back Again
  7. #
  8. cd $(dirname $(which $0))
  9. f=$(basename ../exercises/$1*.zig .zig 2> /dev/null)
  10. b=../exercises/$f.zig
  11. a=../answers/$f.zig
  12. p=patches/$f.patch
  13. printf "\tf: '$f'\n\tb: '$b'\n\ta: '$a'\n"
  14. if [[ ! -f $b ]]; then echo "We hates it!"; exit 1; fi
  15. if [[ ! -a $a ]]; then echo "Where is it? Where is the answer, precious?"; exit; fi
  16. echo Hisssss!
  17. diff $b $a > $p
  18. cat $p