mirror of
https://github.com/notwa/rc
synced 2025-01-04 19:18:04 -08:00
parent
90038bf996
commit
eaa94d66b9
13 changed files with 15 additions and 8 deletions
3
sh/aur
3
sh/aur
|
@ -50,7 +50,7 @@ aur() { ### @-
|
|||
|
||||
# TODO: option to auto install dependencies
|
||||
|
||||
local built=
|
||||
local built= p=
|
||||
for p in "$@"; do
|
||||
cd "$bd"
|
||||
local download_fail=0
|
||||
|
@ -115,6 +115,7 @@ aur() { ### @-
|
|||
fi
|
||||
done
|
||||
|
||||
local recent=
|
||||
cd "$bd"
|
||||
if [ -n "$built" ] && [ $o_install -eq 1 ]; then
|
||||
if [ $o_all_at_once -eq 1 ]; then
|
||||
|
|
3
sh/bak
3
sh/bak
|
@ -20,8 +20,7 @@ bak() { ### @-
|
|||
### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.bak.bak
|
||||
### ```
|
||||
[ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
|
||||
local ret=0
|
||||
local f=
|
||||
local ret=0 f=
|
||||
for f; do
|
||||
if [ -e "$f.bak" ]; then
|
||||
bak "$f.bak" || { ret=1; continue; }
|
||||
|
|
|
@ -16,7 +16,7 @@ baknow() { ### @- backup files by appending their timestamps given by [`now`.](#
|
|||
### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.2001-12-26_01800000.bak
|
||||
### ```
|
||||
argc $# -ge 1 "$0" || return
|
||||
local ret=0
|
||||
local ret=0 f=
|
||||
for f; do
|
||||
cp -ip "$f" "$f.$(now "$f").bak" || ret=1
|
||||
done
|
||||
|
|
2
sh/baks
2
sh/baks
|
@ -19,7 +19,7 @@ baks() { ### @-
|
|||
### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.21-08-01_14-54-07.bak
|
||||
### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.21-08-01_14-54-09.bak
|
||||
### ```
|
||||
local ret=0
|
||||
local ret=0 fp=
|
||||
for fp; do
|
||||
local now="$(date -u '+%y-%m-%d_%H-%M-%S')"
|
||||
local bak="$fp.$now.bak"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
colors2() {
|
||||
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
|
||||
local a= b= i= j=
|
||||
for a in 0 60; do
|
||||
for j in 40 41 43 42 46 44 45 47; do
|
||||
printf ' \033[%s;%sm %03d \033[m' '48;5;16' $((a+j-10)) $((a+j))
|
||||
|
|
|
@ -90,6 +90,8 @@ compile() { ### @-
|
|||
local clang="$(whence -p clang 2>/dev/null)"
|
||||
local clang_flags=() # currently just for clang-msvc
|
||||
|
||||
local flag= d= # iterator variables
|
||||
|
||||
local cl= vc=
|
||||
if [ -n "$MSYSTEM" ]; then # using msys2?
|
||||
if [ -z "$clang" ]; then # don't have native clang?
|
||||
|
|
|
@ -125,6 +125,7 @@ document1() {
|
|||
|
||||
# first section:
|
||||
printf '\n## %s\n' 'shell functions' >> "$out" || return 5
|
||||
local f=
|
||||
for f in sh/*; do
|
||||
[ -e "$f" ] || continue # make sure glob went through
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# probably not compatible with busybox ps because its column 2 isn't PID.
|
||||
|
||||
running() { ### @- WIP
|
||||
local cmd=0 pid=0
|
||||
local cmd=0 pid=0 col=
|
||||
local usage='usage: running {cmd|pid} ...'
|
||||
[ $# -gt 0 ] || { printf '%s\n' "$usage" >&2; return 2; }
|
||||
for col; do
|
||||
|
|
2
sh/sc
2
sh/sc
|
@ -53,7 +53,7 @@ sc() { ### @-
|
|||
return 1
|
||||
}
|
||||
|
||||
local clipboard=""
|
||||
local clipboard="" f=
|
||||
for f; do
|
||||
f="$(readlink -f "$f")"
|
||||
if [ ! -e "$f" ]; then
|
||||
|
|
1
sh/slit
1
sh/slit
|
@ -10,6 +10,7 @@ slit() { ### @-
|
|||
### view specific columns of text.
|
||||
[ $# -gt 0 ] \
|
||||
|| { printf '%s: too few arguments\n' "$0" >&2; return 1; }
|
||||
local arg=
|
||||
for arg; do
|
||||
[ "$arg" -ge 0 ] 2>/dev/null \
|
||||
|| { printf '%s: not a nonnegative integer: %s\n' "$0" "$arg"; return 1; };
|
||||
|
|
1
sh/slitt
1
sh/slitt
|
@ -11,6 +11,7 @@ slitt() { ### @-
|
|||
### this version of `slit` uses tabs for its field separators.
|
||||
[ $# -gt 0 ] \
|
||||
|| { printf '%s: too few arguments\n' "$0" >&2; return 1; }
|
||||
local arg=
|
||||
for arg; do
|
||||
[ "$arg" -ge 0 ] 2>/dev/null \
|
||||
|| { printf '%s: not a nonnegative integer: %s\n' "$0" "$arg"; return 1; };
|
||||
|
|
2
sh/sum
2
sh/sum
|
@ -14,7 +14,7 @@ sum() { ### @-
|
|||
### ```
|
||||
###
|
||||
### **TODO:** consider renaming because sum(1) already exists.
|
||||
local sum=0
|
||||
local sum=0 i=
|
||||
for i; do
|
||||
i="${i%,}"
|
||||
: $((sum+=i))
|
||||
|
|
1
sh/wat
1
sh/wat
|
@ -11,6 +11,7 @@ wat() { ### @-
|
|||
###
|
||||
### written by [leah2.](https://leahneukirchen.org/)
|
||||
( # constrain unalias
|
||||
local cmd=
|
||||
for cmd; do
|
||||
if (( $+aliases[$cmd] )); then
|
||||
printf '%s: aliased to %s\n' $cmd $aliases[$cmd]
|
||||
|
|
Loading…
Reference in a new issue