Michael Uloth
TIL - Today I Learned
- Homebrew packages may install dependencies
I wondered why
brew list
showed so many packages I didn’t install myself.Then, I discovered those are the dependencies of the packages I installed. And the dependencies of those dependencies. And so on.
Seems kinda obvious now.
# Which packages and casks are installed? brew list
# Why is <package-name> installed? Which packages are using it? brew uses <package-name> --installed
# Which dependencies came with <package-name>? brew deps <package-name> --tree
- Shell functions don't need parentheses
Copilot surprised me by generating a
zsh
function that looked like this:function act { # do stuff }
Instead of like this:
act() { # do stuff }
It turns out function parentheses are optional in bash and zsh. Though, using parentheses is more POSIX compliant if that’s relevant for your use case.
In fact, all of these variations are equivalent:
function act () { command } function act() { command } function act { command } act () { command } act() { command } act () command act() command
- You can run shell scripts in tmux.conf
- Create a shell script:
battery.sh#!/usr/bin/env bash echo "♥" $(pmset -g batt | grep -Eo '[0-9]+%')
- Make the file executable:
chmod +x battery.sh
- Call it from within
tmux.conf
:
tmux.confset -g status-right "#($HOME/.config/tmux/battery.sh)"