clipmenu

Simple clipboard management using dmenu
git clone https://git.sinitax.com/cdown/clipmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

clipfsck (714B)


      1#!/usr/bin/env bash
      2
      3shopt -s nullglob
      4
      5cache_dir=$(clipctl cache-dir)
      6cache_file=$cache_dir/line_cache
      7
      8declare -A cksums
      9
     10while IFS= read -r line; do
     11    cksum=$(cksum <<< "$line")
     12    cksums["$cksum"]="$line"
     13
     14    # Are all cache entries represented by a file?
     15    full_file=$cache_dir/$cksum
     16    if ! [[ -f $full_file ]]; then
     17        printf 'cache entry without file: %s -> %s\n' "$line" "$full_file" >&2
     18    fi
     19done < <(cut -d' ' -f2- < "$cache_file")
     20
     21# Are all files represented by a cache entry?
     22for file in "$cache_dir"/[012346789]*; do
     23    cksum=${file##*/}
     24    line=${cksums["$cksum"]-_missing_}
     25    if [[ $line == _missing_ ]]; then
     26        printf 'file without cache entry: %s\n' "$file"
     27    fi
     28done