From 4c94dd5c044d3e3456937919e48481d8b3bb00cb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Jul 2015 19:27:08 -0600 Subject: bash aliases: change mvln --- .config/bash/rc.d/aliases.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to '.config/bash/rc.d/aliases.sh') 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 '^ '; } -- cgit v1.2.3-2-g168b