summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-03-15 20:46:24 -0700
committerBen Sima <ben@bsima.me>2020-03-15 20:47:03 -0700
commit13d0aa95e0bc3d47003ceb00416225777c44c17a (patch)
treed6b1897f0dc057595861f66f8806e7ec73566ba9 /lib
parent374d61a2b1fef8274b77c012978195b225f1a0cc (diff)
Add 'up' function
Diffstat (limited to 'lib')
-rw-r--r--lib/common.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/common.nix b/lib/common.nix
index 4fa34a3..bb89efa 100644
--- a/lib/common.nix
+++ b/lib/common.nix
@@ -134,7 +134,15 @@ in
function cd() {
builtin cd "$@" && ls
}
-
+ function up() {
+ N=$1
+ P=$PWD
+ for (( i=1; i<=$N; i++ ))
+ do
+ P+="/.."
+ done
+ cd "$P"
+ }
# my prompt, after much chagrin
export PS1="\n\[\e[34m\][\u@\h:\w]\[\e[m\] \$(date +%Y.%m.%d..%H.%M) \$(if [ \$? == 0 ]; then true; else echo \(\$?\); fi) \n$ "
'';