summaryrefslogtreecommitdiff
path: root/.config/bash
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-07-19 19:27:08 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-07-19 19:29:48 -0600
commit4c94dd5c044d3e3456937919e48481d8b3bb00cb (patch)
tree9048b2d86e044fa81a6b00e2971a69a715363336 /.config/bash
parent83431d32040061990874bebd6150eeab80aa0322 (diff)
bash aliases: change mvln
Diffstat (limited to '.config/bash')
-rw-r--r--.config/bash/rc.d/aliases.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/.config/bash/rc.d/aliases.sh b/.config/bash/rc.d/aliases.sh
index 6b2460e..cd2cfd8 100644
--- a/.config/bash/rc.d/aliases.sh
+++ b/.config/bash/rc.d/aliases.sh
@@ -46,7 +46,18 @@ alias userctl='systemctl --user'
######################################################################
alias lock="clear; away -C 'This terminal is locked'"
alias plock="term-title Terminal Locked;lock"
-mvln() { mv $1 $2; ln -s $2 $1; }
+mvln() {
+ if [[ ! -L "$1" ]]; then
+ libremessages error 'Not a soft link: %s' "$1"
+ fi
+ target=$(readlink -f -- "$1")
+ ln -srT -- "$target" "$2"
+ if cmp -- "$1" "$2"; then
+ rm -f -- "$1"
+ else
+ libremessages error 'Failed moving link: %s -> %s' "$1" "$2"
+ fi
+}
jarls() { jar tf "$1" | sed -n 's/\.class$//p' | LC_ALL=C sort | xargs -r -d $'\n' javap -classpath "$1"; }
tarls() { local file; for file in "$@"; do bsdtar tf "$file" | sed "s|^|$file:|"; done; }
jarmain() { jarls "$1" 2>/dev/null | grep -E '(^[a-z]|public static void main\(java\.lang\.String\[\]\))' | grep -B1 '^ '; }