cda: now takes arguments for what dirs to open
This commit is contained in:
parent
e79e0989e6
commit
942ddfa4fb
1 changed files with 11 additions and 8 deletions
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# Source this and then run `cda`
|
# Usage:
|
||||||
|
# cda <dirs>
|
||||||
|
|
||||||
# cd all: opens a new shell in each of the directories below the one you're in, so
|
# cd all: opens a new shell in each of the passed dirs
|
||||||
# you can execute commands in them until you type 'exit'
|
|
||||||
# If I use this enough, I may make something that can do more
|
# Ideas for improvement:
|
||||||
# Ideas for what it could do in the future:
|
|
||||||
# - somehow record typed commands so they can be automatically repeated like a macro
|
# - 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 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
|
# - Maybe just add an argument that takes a command and executes it in all dirs
|
||||||
|
@ -12,8 +12,11 @@
|
||||||
# that by just writing a for loop)
|
# that by just writing a for loop)
|
||||||
|
|
||||||
cda() {
|
cda() {
|
||||||
for DIR in *; do
|
for DIR in "$@"; do
|
||||||
(cd "$DIR" && zsh)
|
echo
|
||||||
|
echo "$DIR"
|
||||||
|
(cd "$DIR" && $SHELL)
|
||||||
done
|
done
|
||||||
|
echo "$0: done"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue