From 4b6c0e31385f5f27a151088c0a2b614495c4e589 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 14 Oct 2021 12:47:50 -0400 Subject: initial commit, including theme --- content/posts/2003-11-06-cdup-fun.html | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 content/posts/2003-11-06-cdup-fun.html (limited to 'content/posts/2003-11-06-cdup-fun.html') 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! +--- + +

+Richard (richlowe) and a few other people from #fu were talking about being able to do things like cdup 5 to jump up 5 directories. I thought it would be nicer if my existing .. alias took an optional argument to do the same thing. Here's the result (for bash): +

+ +

+

+function cdup() {
+  if [ "x$1" = "x" ]; then max=1; else max=$1; fi
+  for ((i=0; i<$max; i++)); do cd ..; done 
+}
+
+alias ..="cdup";
+
+

+ +

+So .. works the same as it did before, but now you can do stuff like this: +

+ +

+

+pabs@vault:/usr/local/share/raggle/themes> ..
+pabs@vault:/usr/local/share/raggle> .. 2
+pabs@vault:/usr/local> 
+
+

+ +

+Richard's version does the same thing for zsh. +

+ -- cgit v1.2.3