10 let PATH = stdenv.lib.concatStringsSep ":"
 
  18 writeShellScriptBin "smartctl-tbw" ''
 
  20   device=''${1:-/dev/sda}
 
  21   sudo ${smartmontools}/bin/smartctl -A $device |
 
  23     $0 ~ /Power_On_Hours/ { poh=$10; printf "%s / %d hours / %d days / %.2f years\n",  $2, $10, $10 / 24, $10 / 24 / 365.25 }
 
  24     $0 ~ /Total_LBAs_Written/ {
 
  30         printf "%s / %s  / %d mb / %.1f gb / %.3f tb\n", $2, $10, mb, gb, tb
 
  31         printf "mean writes per hour:  / %.2f",  mb/poh
 
  33     $0 ~ /Airflow_Temperature_Cel/ { print $2 " / " $10}
 
  34     $0 ~ /Wear_Leveling_Count/ { printf "%s / %d (%% health)\n", $2, int($4) }
 
  37   sed -e "s\$^\$$device @ \$" |