Created
May 22, 2012 22:26
-
-
Save orymate/2772045 to your computer and use it in GitHub Desktop.
my interactive zsh functions
This file contains hidden or 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
# change to temp dir | |
t() { | |
if [ ${1:-0} -eq 0 ] | |
then | |
mkdir -p ~/temp/$(date -d "${1:-0} days ago" +%Y%m%d) | |
fi | |
cd ~/temp/$(date -d "${1:-0} days ago" +%Y%m%d) | |
} | |
# scp if any arguments contain a colon | |
scp () { | |
for i in $* | |
do case $i in | |
*:*) command scp $* | |
return $? | |
esac | |
done | |
echo No remote path parameter. Aborting. | |
return 1 | |
} | |
# change to previous directory | |
p() { | |
cur=$(basename "$PWD") | |
cd $(dirname "$PWD")/$(ls $(dirname "$PWD") -a |grep -EB1 "^${cur}/?$"|head -1) | |
} | |
# change to next directory | |
n() { | |
cur=$(basename "$PWD") | |
cd $(dirname "$PWD")/$(ls $(dirname "$PWD") -a |grep -EA1 "^${cur}/?$"|tail -1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment