dotfiles/.config/shell/functions/cda

23 lines
622 B
Bash

#!/bin/sh
# Usage:
# cda <dirs>
# cd all: opens a new shell in each of the passed dirs
# Ideas for improvement:
# - somehow record typed commands so they can be automatically repeated like a macro
# - maybe get the length of the histfile before and after, executing the last X number of commands
# - Maybe just add an argument that takes a command and executes it in all dirs
# (although that wouldn't be as good as recording actions bc it's easy to do
# that by just writing a for loop)
cda() {
for DIR in "$@"; do
echo
echo "$DIR"
(cd "$DIR" && $SHELL)
done
echo
echo "$0: done"
}