I always look up the same things again and again and/or refer to old scripts where I’ve done the looking up. Might as well start dumping some things here.
I think this is compatible with bash/zsh, but not sure. I tend to stick to bash for scripts for portability, just in case.
1
2
3
4
5
6
7
8
9
10
11
packages=( ctop lazydocker )for i in "${packages[@]}"doecho"Checking if $i is available..."if[ -x "$(command -v $i)"];thenecho"Found $i"else brew install $ifidone