# Fix tmux resurrect files, but only if resurrect files have already been restored! shopt -s nullglob dotglob files=(~/.tmux/resurrect/*) if (( ${#files[*]} )) ## First check whether directory is empty, and if it is not, then abort. then if f() { local F; for F; do [[ -L $F ]] || return 1; done; return 0; }; f ~/.tmux/resurrect/* ## If it's not empty, check whether it contains only symlinks. then bash ~/env_deploy/tmux_fix.sh ## If it contains only symlinks, run that script. else echo "Don't forget to restore tmux-resurrect files!" fi else echo "Directory not empty, aborting..." && exit 1 fi shopt -u nullglob dotglob