bash-bear rename and a few improvements
[distro-setup] / brc
diff --git a/brc b/brc
index 5aff8e034848cbbfb816f6cd54d65d2055ecd0e7..a47a6fa6cb6d99ef82ae7eb6be6742e868958bf8 100644 (file)
--- a/brc
+++ b/brc
@@ -14,9 +14,9 @@ if [[ -s /a/bin/bash-bear-trap/bash-bear ]]; then
 else
   # bleh shellcheck can't handle disabling in an elif, so nesting this if.
   # shellcheck disable=SC2154 # set in .bashrc
-  if [[ -s $bashrc_dir/err ]]; then
+  if [[ -s $bashrc_dir/bash-bear ]]; then
     # shellcheck source=/a/bin/bash-bear-trap/bash-bear
-    source $bashrc_dir/err
+    source $bashrc_dir/bash-bear
   fi
 fi
 
@@ -725,6 +725,7 @@ khcopy() {
   ssh-copy-id $1
 }
 
+# copy path into clipboard
 a() {
   local x
   x=$(readlink -nf "${1:-$PWD}")
@@ -1455,13 +1456,22 @@ g() {
 gp() {
   cat &>/a/tmp/gtmp
   g "$@" /a/tmp/gtmp
-  }
-
-# like cmd &> tempfile; emacs tempfile
-gc() {
+}
+# g log
+#like cmd &> tempfile; emacs tempfile
+#
+# note: a useful workflow for doing mass replace on my files:
+# gc rem REGEX
+## remove any false positives, or manually edit them. rename files if needed.
+# sedi 's/REGEX/REPLACEMENT/' $(gr '^/' /a/tmp/gtmp)
+gl() {
   "$@" &> /a/tmp/gtmp
   g /a/tmp/gtmp
-  }
+}
+# g command substitution
+gc() {
+  g $("$@")
+}
 
 # force terminal version
 gn() {
@@ -2801,6 +2811,8 @@ leap-year() {
 # on-battery
 on-bat() {
   if [[ -e /sys/class/power_supply/AC/online && $(</sys/class/power_supply/AC/online) == 0 ]]; then
+    return 0
+  else
     return 1
   fi
 }
@@ -2846,6 +2858,30 @@ cm() {
 }
 
 
+disk-info() {
+  local cmds cmd
+  mapfile -t cmds <<'EOF'
+tail -n +1 /proc/mdstat /etc/mdadm/mdadm.conf /etc/fstab /etc/crypttab
+lsblk
+blkid
+ls -la /dev/disk/by-id
+EOF
+
+  for cmd in "${cmds[@]}"; do
+    cat <<EOF
+### $cmd
+
+\`\`\`
+EOF
+    $cmd
+    cat <<'EOF'
+
+```
+
+EOF
+  done
+}
+
 # * misc stuff