Files
dotfiles/local/bin/x-foreach
Ismo Vuorinen bb3f4a8f6c Many updates and improvements
- yamllint
- shfmt config
- fix Go bin path
- fix git credentials config
- add nvm default packages
- updated Brewfile
2023-03-28 15:27:44 +03:00

17 lines
304 B
Bash
Executable File

#!/usr/bin/env bash
#
# foreach <folder> <commands that should be run to each file>
#
# Source: https://github.com/mvdan/dotfiles/blob/master/.bin/foreach
cmd=$1
shift
for dir in $($cmd); do
(
echo "$dir"
cd "$dir" || exit 1
eval "$@" # allow multiple commands like "foo && bar"
)
done