BASH   89
tftpdiff
Guest on 16th March 2023 12:20:23 AM


  1. #!/bin/sh
  2.  
  3. if [ "$1" == "" ]
  4. then
  5.     echo "Syntax:  $0 filename [version]"
  6.     echo " diff between two versions of a file kept in pumpkin tftp server"
  7.     echo " diff is between version and version-1.  If version not specified, most current is used."
  8.     exit
  9. fi
  10.  
  11. # compare the current version of the $1 file with the immediately previous one.  Does not work for file (1) and the original
  12. # uses pumpkins file versioning. For instance:
  13. # file (1)
  14. # file (2)
  15. # file (3)
  16.  
  17. # @@ fix this to match the location of your tftp folder
  18. cd ~/PATH_TO_WHERE_THE_FILES_BE/
  19.  
  20. if [ "$2" == "" ]
  21. then
  22.   let new=`ls -lrt $1* | awk '{ f=$NF }; END{ print f }'|tr -d " " |tr -d "(" | tr -d ")"`
  23.   echo "Current version is $new";
  24. else
  25.   let new=$2
  26. fi
  27. let old=$new-1;
  28.  
  29. diff $1\ \($new\) $1\ \($old\)

Raw Paste

Login or Register to edit or fork this paste. It's free.