diff --git a/.local/bin/scripts/bog b/.local/bin/scripts/bog index c8bbb8f..0912aca 100755 --- a/.local/bin/scripts/bog +++ b/.local/bin/scripts/bog @@ -1,6 +1,9 @@ #!/bin/sh -e # Simple backup with borg -test $# -eq 0 && borg list --format "{barchive:40} {time}{NL}" && exit 0 +if test $# -eq 0 + then borg list --format "{barchive:40} Created {time}{NL}" + exit $? +fi test "$1" = "-n" && run=arg-test && shift case "$1" in (*_) prefix=$1; shift;; esac name="$(echo "$1" | diff --git a/.local/bin/scripts/difc b/.local/bin/scripts/difc new file mode 100755 index 0000000..6182037 --- /dev/null +++ b/.local/bin/scripts/difc @@ -0,0 +1,8 @@ +#!/bin/sh +# Diff the result of the given commands +prefix=/tmp/difc- +highlight "Executing $1" +eval "$1" | sort >${prefix}1 +highlight "Executing $2" +eval "$2" | sort >${prefix}2 +dif "${prefix}1" "${prefix}2" diff --git a/.local/bin/scripts/latest b/.local/bin/scripts/latest index 86d77c5..d0525f1 100755 --- a/.local/bin/scripts/latest +++ b/.local/bin/scripts/latest @@ -1,3 +1,5 @@ #!/bin/sh -e # Displays the latest files in the given directory or pwd -find "${1:-$PWD}" -maxdepth 4 -type f -printf '%.16T+ %P\n' | sort -r | head +test "$1" = "-a" && all=true && shift +find "${1:-$PWD}" -maxdepth 4 -type f -printf '%.16T+ %P\n' | + sort -r | $(test "$all" && echo "less" || echo "head")