diff --git a/1996/gandalf/try.sh b/1996/gandalf/try.sh index b37d65d0e..4acf4097a 100755 --- a/1996/gandalf/try.sh +++ b/1996/gandalf/try.sh @@ -41,13 +41,14 @@ trap 'rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.tx show_diff() { - if [[ "$#" -ne 2 ]]; then + if [[ "$#" -ne 3 ]]; then echo "$0: show_diff expects two args, got: $#" 1>&2 exit 1 fi - read -r -n 1 -p "Press any key to run: diff $1 $2: " + echo "$ diff $1 $2 ($3): " 1>&2 + read -r -n 1 -p "Press any key to continue: " echo 1>&2 - diff "$1" "$2" && echo "$1 and $2 are identical" + diff -C 1 "$1" "$2" && echo "$1 and $2 are identical" echo 1>&2 } @@ -72,8 +73,7 @@ echo 1>&2 cathat | tee cathat.txt echo 1>&2 -echo "Showing diff between the above two commands, 'hatcat' and './cathat':" 1>&2 -show_diff hatcat.txt cathat.txt +show_diff hatcat.txt cathat.txt "diff between 'hatcat' and './cathat'" read -r -n 1 -p "Press any key to run: ./hatcat | tee hatcat2.txt: " echo 1>&2 @@ -83,8 +83,7 @@ read -r -n 1 -p "Press any key to run: ./cathat | tee cathat2.txt: " echo 1>&2 ./cathat | tee cathat2.txt -echo "Showing diff between running 'hatcat' and './hatcat':" 1>&2 -show_diff hatcat.txt hatcat2.txt +show_diff hatcat.txt hatcat2.txt "diff between 'hatcat' and './hatcat'" read -r -n 1 -p "Press any key to run: \$(pwd)/cathat | tee cathat3.txt: " echo 1>&2 @@ -94,23 +93,17 @@ read -r -n 1 -p "Press any key to run: \$(pwd)/hatcat | tee hatcat3.txt: " echo 1>&2 "$(pwd)"/hatcat | tee hatcat3.txt -echo "Showing diff between running './hatcat' and './cathat':" 1>&2 -show_diff hatcat2.txt cathat2.txt +show_diff hatcat2.txt cathat2.txt "diff between './hatcat' and './cathat'" -echo "Showing diff between running '\$(pwd)/hatcat' and '\$(pwd)/cathat':" 1>&2 -show_diff hatcat3.txt cathat3.txt +show_diff hatcat3.txt cathat3.txt "diff between '\$(pwd)/hatcat' and '\$(pwd)/cathat'" -echo "Showing diff between running '\$(pwd)/hatcat' and 'hatcat':" 1>&2 -show_diff hatcat3.txt hatcat.txt +show_diff hatcat3.txt hatcat.txt "diff between '\$(pwd)/hatcat' and 'hatcat'" -echo "Showing diff between running '\$(pwd)/hatcat' and './hatcat':" 1>&2 -show_diff hatcat3.txt hatcat2.txt +show_diff hatcat3.txt hatcat2.txt "diff between '\$(pwd)/hatcat' and './hatcat'" -echo "Showing diff between running '\$(pwd)/cathat' and 'cathat':" 1>&2 -show_diff cathat3.txt cathat.txt +show_diff cathat3.txt cathat.txt "diff between \$(pwd)/cathat' and 'cathat'" -echo "Showing diff between running '\$(pwd)/cathat' and './cathat':" 1>&2 -show_diff cathat3.txt cathat2.txt +show_diff cathat3.txt cathat2.txt "diff between '\$(pwd)/cathat' and './cathat'" # remove temporary files rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt