fi
+
+
mysrc() {
local path dir file
path=$1
# we have ~33 buttons as of this writing, so lets
# prune down the history every once in a while.
if (( start > 500 )); then
- tac ~/.cdirs | awk '!seen[$0]++' | head -n 200 | sponge ~/.cdirs
+ tac ~/.cdirs | awk '!seen[$0]++' | head -n 200 | tac | sponge ~/.cdirs || [[ $? == 141 ]]
fi
for (( j=$start; j >= 0; j-- )); do
fi
read -r -N 1 input
if [[ $input != $'\n' ]]; then
- c ${buttondirs[$input]}
+ c "${buttondirs[$input]}"
fi
}
# back list
}
-# for running in a fai rescue
+# for running in a fai rescue. iank specific.
kdrescue() {
d=vgata-Samsung_SSD_850_EVO_2TB_S2RLNX0J502123D
for f in $d vgata-Samsung_SSD_870_QVO_8TB_S5VUNG0N900656V; do
}
+chownme() {
+ s chown -R $USER:$USER "$@"
+}
+
# shellcheck disable=SC2032
chown() {
# makes it so chown -R symlink affects the symlink and its target.
done
}
+# df progress
+# usage: dfp MOUNTPOINT [SECOND_INTERVAL]
+# SECOND_INTERVAL defaults to 90
+dfp() {
+ # mp = mountpoint
+ local a b mp interval
+ mp=$1
+ interval=${2:-90}
+ if [[ ! $mp ]]; then
+ echo "dfp: error, missing 1st arg" >&2
+ return 1
+ fi
+ while true; do
+ a=$(df --output=used $mp | tail -n1)
+ sleep $interval
+ b=$(df --output=used $mp | tail -n1)
+ printf "used mib: %'d mib/min: %s\n" $(( b /1000 )) $(( (b-a) / (interval * 1000 / 60 ) ))
+ done
+}
+
# get ipv4 ip from HOST. or if it is already a number, return that
hostip() {
local host="$1"
printf "%s" "${arg}" |& hexdump -C
done
}
-# echo vars. print var including escapes, etc
+
+# echo variables. print var including escapes, etc, like xxd for variable
ev() {
if (( ! $# )); then
echo no args