1. 2

    are there are good,quick,small scripts to create summary statistics and histograms for numbers? numutils is mentioned in the description of moreutils, but it doesnt appear to provide those.

    atchange is a handy script to trigger a command whenever a file gets updated. I use it to automate the edit-save-run loop when writing code. It’s not technically in my /bin directory, it’s in .bash_aliases as a shell script, which I wrote after reading about the original perl script described here

    # atchange $1 $2
    # runs command $2 whenever file $1 is modified
    function atchange(){
      if [ "$#" -lt 2 ]
      then
        echo "Insufficient arguments. Requires at least 2"
        echo "Usage: atchange [filename] [command(s)]"
      else
        FILE="$1"
        shift
        COMMAND="$@"
        oldmodtime=""
        while [ -f "$FILE" ] || ! echo "File $FILE not found" 
        do 
          #inotifywait -qq -e modify "$FILE"; # disabled to remove dependency. use polling instead
          newmodtime=`stat -c %y "$FILE"`
          if [ -z "$oldmodtime" ]; then
            oldmodtime="$newmodtime"
          fi
          if [ "$newmodtime" != "$oldmodtime" ]; then
            echo "*** atchange: $FILE change detected ($newmodtime) ***"
            sleep 1 # may not be necessary
            $COMMAND
            oldmodtime="$newmodtime"
          fi
          sleep 2 # polling interval
        done
      fi
    }
    
    1. 2

      Perhaps spark.