bin: some more utilities

This commit is contained in:
xeruf 2021-12-02 23:33:22 +01:00
parent 3fc358fd1d
commit 1cdb307e2a
3 changed files with 15 additions and 2 deletions

View File

@ -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" |

8
.local/bin/scripts/difc Executable file
View File

@ -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"

View File

@ -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")