#!/bin/bash source /a/bin/errhandle/err e() { echo "$*"; "$@"; } lnf() { /a/bin/lnf/lnf "$@"; } shopt -s nullglob shopt -s extglob cd /a/exe declare -A existing for f in *; do existing[$f]=t done cd /a/bin # sourcing instead of calling script changes runtime from .47s to .36s source /a/bin/lnf/lnf >/dev/null ||: for x in !(unused|distro-setup|unfinished|queue|bash-template|buildscripts|crons|data|examples|log-quiet); do [[ -e $x/.git ]] || continue for y in $x/*; do f=${y##*/} if [[ -x $y && ! -d $y ]]; then unset "existing[$f]" lnf -v /a/bin/$y /a/exe fi done done for x in *; do if [[ ! -d $x && -x $x ]]; then unset "existing[$x]" lnf -v /a/bin/$x /a/exe fi done cd /a/exe for f in ${!existing[@]}; do echo want to do rm -fv $f done # things we don't want to run in /a, because # they are long running and could get in the way of # btrfs remounting e /a/bin/distro-setup/install-my-scripts