From 13d0aa95e0bc3d47003ceb00416225777c44c17a Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 15 Mar 2020 20:46:24 -0700 Subject: Add 'up' function --- lib/common.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/common.nix') 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$ " ''; -- cgit v1.2.3