From 85ed203292b8f30facf5a9b0f38e2e00e4184701 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Mon, 13 May 2024 04:06:00 -0500 Subject: [PATCH] Add some basic common utilities --- dotlib/post/util.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dotlib/post/util.sh diff --git a/dotlib/post/util.sh b/dotlib/post/util.sh new file mode 100644 index 0000000..4da8d30 --- /dev/null +++ b/dotlib/post/util.sh @@ -0,0 +1,24 @@ +ll() { + command ls -AlF "$@" +} + +ssh() { + TERM=xterm-256color command ssh "$@" +} + +awk-find() { + if (( $# > 1 )); then + local find_in=${TO_FIND:-.} file pattern=$1 to_find=( ) + + for file in "${@:2}"; do + to_find+=(-name "$file" -o) + done + + find "$find_in" -not -name . "(" "${to_find[@]::${#to_find[@]} - 1}" ")" -print0 | + awk -F / -v RS="\0" "$pattern" + fi +} + +clbin() { + tail -n +1 -- "$@" | curl -sSF 'clbin=<-' https://clbin.com +}