From 7caae5b8bc474226f97df24eb9b629bc42bae485 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 5 Jan 2020 00:01:20 -0700 Subject: [PATCH] develop:zsh: new shell functions * rnm: don't ever repeat yourself in the shell * chext: easily change file extension --- profiles/develop/zsh/functions/chext | 5 +++++ profiles/develop/zsh/functions/rnm | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 profiles/develop/zsh/functions/chext create mode 100644 profiles/develop/zsh/functions/rnm diff --git a/profiles/develop/zsh/functions/chext b/profiles/develop/zsh/functions/chext new file mode 100644 index 00000000..52905a9f --- /dev/null +++ b/profiles/develop/zsh/functions/chext @@ -0,0 +1,5 @@ +[[ -z $3 ]] || return 1 +file=$1 +ext=$2 +new="${file:r}.${ext}" +mv $file $new diff --git a/profiles/develop/zsh/functions/rnm b/profiles/develop/zsh/functions/rnm new file mode 100644 index 00000000..766bc9cf --- /dev/null +++ b/profiles/develop/zsh/functions/rnm @@ -0,0 +1,4 @@ +[[ -z $3 ]] || return 1 +head=${1:h} +name="${head}/${2}" +mv $1 $name