|
|
|
|
|
by bilalq
3283 days ago
|
|
bash functions: # Helper function for running command in each subdirectory under current one.
function each {
if [ -z $1 ]; then
: # If no command is given, then this is a no-op.
else
find . -maxdepth 1 -mindepth 1 -not -path '*/\.*' -type d -exec sh -c "(echo {} && cd {} && $* && echo)" \;
fi
}
zsh functions: # Helper function for navigating tmux sessions
export WORKSPACE_ROOT=$HOME/workspace
ws() {
if [ -z $1 ]; then
if [ -z $TMUX ]; then
tmux attach-session
else
cd $WORKSPACE_ROOT
fi
elif [[ $1 == 'ls' ]]; then
tmux list-sessions
else
tmux attach -t $1 || cd $WORKSPACE_ROOT/$1/src; tmux new-session -s $1
fi
}
# Helper function for running command in each subdirectory under current one.
each() {
if [ -z $1 ]; then
# If no command is given, just exit
else
find . -maxdepth 1 -mindepth 1 -not -path '*/\.*' -type d -exec sh -c "(echo {} && cd {} && $* && echo)" \;
fi
}
|
|