Bash

1. 测试框架

bats-core 看上去非常科学且成熟 https://bats-core.readthedocs.io/en/stable/tutorial.html

2. Caveats

2.1. SSH eats remains of stdin

while read + loop 内一个会读 stdin 的指令就会触发这个问题。

https://stackoverflow.com/questions/9393038/ssh-breaks-out-of-while-loop-in-bash

3. 关联数组

4. 检查 symlink target 是否存在

for d in *; do
    for f in $d/*.el; do
        if [ ! -e $f ]; then
            echo $d
            echo $f
            break
        fi
    done
done

Updated: 2025-12-04 Thu 02:42