Created
November 29, 2011 15:26
-
-
Save peteb/1405164 to your computer and use it in GitHub Desktop.
Aliases for mkdir && cd. Quite common usage that is finally improved!
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
alias mkc "mkdir \!^ && cd \!^" | |
alias mkt 'cd `~/bin/mktest`' |
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
#!/usr/bin/ruby | |
# creates a new directory called "test" + a running counter at the end. if test3 exists, create test4. if no test exists, create test1. | |
test_dir = (`ls -tr | grep test | tail -1` =~ /^test(.*)$/ \ | |
&& "test" + ($1.to_i+1).to_s \ | |
|| "test1") | |
`mkdir #{test_dir}` | |
puts test_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment