Created
February 25, 2015 18:26
-
-
Save nickcarenza/535313e62b3f07c8f416 to your computer and use it in GitHub Desktop.
Useful shell functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotil() { | |
echo "Trying '${@}'" | |
until $@; do :; done | |
} | |
inTmux() { | |
if ! { [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; } then return 1; fi | |
} | |
pane() { | |
if ! inTmux; then tmux "pane ${@}" && return; fi | |
tmux split-window -l 5 "${@} && sleep 5 && exit" -d | |
#echo "${@}" | |
#tmux split-window -d -l 5 -t "${@}" | |
#tmux split-window -l 5 | |
#$@ | |
#echo "Process completed. Exiting in 20 seconds" | |
#sleep 10 | |
#exit | |
} | |
# Attempt to determine what went wrong with previous command | |
# and suggest a different command to run instead | |
_() { | |
# TODO check if previous command was git push | |
if [[ $? == 128 ]] ; then | |
# get local branch name | |
# maybe prompt for remote | |
read -n 1 -p "git push --set-upstream origin master? " yn | |
printf "\n" | |
case $yn in | |
[Yy]* ) git push --set-upstream origin master; printf "\n";; | |
esac | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment