Add some basic common utilities

This commit is contained in:
Nick Chambers 2024-05-13 04:06:00 -05:00
parent 5fbe0c7b41
commit 85ed203292

24
dotlib/post/util.sh Normal file
View file

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