diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2013-08-22 19:01:51 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2013-08-22 19:01:51 +0200 |
commit | c49882e7943d20327319bf7d3223927aad9cf126 (patch) | |
tree | ab56ba0160d68817c0608ae249e890aad2a3f957 /.bashrc | |
parent | 06186d3f3084b00a3c9f025d7fa3ca772c642493 (diff) | |
download | dotfiles-c49882e7943d20327319bf7d3223927aad9cf126.tar.gz dotfiles-c49882e7943d20327319bf7d3223927aad9cf126.tar.xz dotfiles-c49882e7943d20327319bf7d3223927aad9cf126.zip |
Bash config: define and use diralias helper
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -24,9 +24,16 @@ alias acka='ack -a --follow' # debug, etc. alias hist-del-last='history -d $(history 1 | cut -d" " -f2)' # historical NOOP -# proper aliases -alias gmy="pushd ~/wrkspc/gmy >/dev/null" -alias gwork="pushd ~/wrkspc/gwork >/dev/null" +# dir aliases (use either as "gmy" or "rd $(gmy)") +_diralias () { + test "$(pwd)" = "$(eval echo "$(dirs +1)")" && popd -n &>/dev/null + test "$1" = "$(eval echo "$(dirs +0)")" || pushd "$1" >/dev/null + pwd +} +diralias () { alias "$(basename "$1")=_diralias $1"; } + +diralias ~/wrkspc/gmy +diralias ~/wrkspc/gwork # debug, etc. |