Last active
March 10, 2021 22:53
-
-
Save marekkowalczyk/5f6d00578ff89ef0d91638e8d7f3d9d5 to your computer and use it in GitHub Desktop.
Bash function to edit and source *rc files; best included in .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rc(){ | |
# TODO XDG Path | |
EDITORRC="$EDITOR" | |
FILE="" | |
case "$1" in | |
help) | |
printf "aliasesicalbuddy\n" | |
printf "aliasestask\n" | |
printf "aliases\n" | |
printf "bash\n" | |
printf "prompt\n" | |
printf "reminders\n" | |
printf "task\n" | |
printf "tmux\n" | |
printf "vim\n" | |
;; | |
tmux) | |
FILE="~/.tmux.conf" | |
;; | |
reminders) | |
FILE="~/.reminders" | |
;; | |
*) | |
FILE="~/." | |
FILE+="$1" | |
FILE+="rc" | |
;; | |
esac | |
if [[ ! -z "$FILE" ]] | |
then | |
$EDITORRC "$FILE" | |
source "$FILE" | |
printf "$FILE updated\n" | |
printf "Try also `rc help`" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment