X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=048fa5131688e744e27f66aa2c463a746fefa548;hb=2ff8740f1061a31683152a4447340921de82b1b9;hp=49c9a26120fe0ea5620c8fa4c53043479d3da712;hpb=4663e4d326450af70ab827ba458f964a11faaff1;p=distro-setup diff --git a/brc b/brc index 49c9a26..048fa51 100644 --- a/brc +++ b/brc @@ -318,10 +318,12 @@ h() { # note. ## copy bash completion -# Usage: ORIGINAL_COMMAND TARGET_COMMAND... # # It copies how the bash completion works from one command to other -# commands. +# commands. Generally just use within a .bashrc. +# +# Usage: ORIGINAL_COMMAND TARGET_COMMAND... +# ccomp() { local c src src=$1 @@ -336,17 +338,21 @@ ccomp() { eval $c $* } -## BEGIN directory history tracking and navigation. +## BEGIN functions to change directory better than cd ## # -# use c instead of cd (could alias to cd if you wanted). b to go back, f -# to go forward, cl to list recent directories and choose one. +# The functions: # -# The finer details you may want to skip: +# c: acts like cd, but stores directory history: you could alias to cd if you wanted. +# b: go back +# f: go forward +# cl: list recent directories and optionally choose one. # -# We also define bl to print the list of back and forward directories. +# Finer details you may want to skip: # -# We keep 2 stacks, forward and back. Unlike with a web browser, the -# forward stack is not erased when going somewhere new. +# bl: print the list of back and forward directories. +# +# We keep 2 stacks of directories, forward and back. Unlike with a web +# browser, the forward stack is not erased when going somewhere new. # # Recent directories are stored in ~/.cdirs. # @@ -448,7 +454,7 @@ f() { # printf "%s\n" "${_dir_forward[-1]}" # fi } -# cd list +# cl = cd list cl() { local i line input start local -A buttondirs alines @@ -495,8 +501,8 @@ cl() { c "${buttondirs[$input]}" fi } -# list the back and forward directories. i tend to forget this exists -# and use cl instead. +# bl = back list. lists the back and forward directories. i tend to +# forget this exists and use cl instead. bl() { local start i j max max=10 @@ -537,6 +543,7 @@ bl() { fi done } +## END functions to change directory better than cd ## # pee do. run args as a command with output copied to syslog. # @@ -685,33 +692,6 @@ khcopy() { ssh-copy-id $1 } -# ya, hacky hardcoded hostnames in 2023. we could do better -hssh-update() { - local -a failed_hosts hosts - case $HOSTNAME in - sy|kd) - hosts=( - kd x3.office.fsf.org syw - ) - ;; - x3) - hosts=( - b8.nz sywg.b8.nz - ) - ;; - esac - for host in ${hosts[@]}; do - e $host - if ! scp /b/fai/fai/config/files/usr/local/bin/hssh/IANK root@$host:/usr/local/bin/hssh; then - failed_hosts+=($host) - fi - done - if (( ${#failed_hosts[@]} >= 1 )); then - echo failed_hosts=${failed_hosts[*]} - return 1 - fi -} - a() { local x x=$(readlink -nf "${1:-$PWD}")