diff options
author | Paul Duncan <pabs@pablotron.org> | 2021-10-14 12:47:50 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2021-10-14 12:47:50 -0400 |
commit | 4b6c0e31385f5f27a151088c0a2b614495c4e589 (patch) | |
tree | 12243cdcd00704bc1a9d94ac9cc128459417370c /content/posts/2003-11-06-cdup-fun.html | |
download | pablotron.org-4b6c0e31385f5f27a151088c0a2b614495c4e589.tar.bz2 pablotron.org-4b6c0e31385f5f27a151088c0a2b614495c4e589.zip |
initial commit, including theme
Diffstat (limited to 'content/posts/2003-11-06-cdup-fun.html')
-rw-r--r-- | content/posts/2003-11-06-cdup-fun.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/content/posts/2003-11-06-cdup-fun.html b/content/posts/2003-11-06-cdup-fun.html new file mode 100644 index 0000000..68aed0b --- /dev/null +++ b/content/posts/2003-11-06-cdup-fun.html @@ -0,0 +1,36 @@ +--- +date: "2003-11-06T19:20:55Z" +title: cdup Fun! +--- + +<p> +<a href='http://www.richlowe.net/'>Richard (richlowe)</a> and a few other people from <code>#fu</code> were talking about being able to do things like <kbd>cdup 5</kbd> to jump up 5 directories. I thought it would be nicer if my existing <kbd>..</kbd> alias took an optional argument to do the same thing. Here's the result (for bash): +</p> + +<p> +<pre> +function cdup() { + if [ "x$1" = "x" ]; then max=1; else max=$1; fi + for ((i=0; i<$max; i++)); do cd ..; done +} + +alias ..="cdup"; +</pre> +</p> + +<p> +So <kbd>..</kbd> works the same as it did before, but now you can do stuff like this: +</p> + +<p> +<pre> +pabs@vault:/usr/local/share/raggle/themes> .. +pabs@vault:/usr/local/share/raggle> .. 2 +pabs@vault:/usr/local> +</pre> +</p> + +<p> +<a href='http://www.richlowe.net/cdup.zsh'>Richard's version</a> does the same thing for <a href='http://www.zsh.org/'>zsh</a>. +</p> + |