From 8313dfb488b2184c3ea32bd9059f334068aab851 Mon Sep 17 00:00:00 2001 From: ysk Date: Thu, 12 Oct 2023 08:27:18 +0900 Subject: [PATCH 1/2] add install scripts --- install_bashrc.sh | 28 ++++++++++++++++++++++++++++ install_zshrc.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100755 install_bashrc.sh create mode 100755 install_zshrc.sh diff --git a/install_bashrc.sh b/install_bashrc.sh new file mode 100755 index 0000000..4a10a51 --- /dev/null +++ b/install_bashrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +ask_yes_no () { + msg="$1" + + echo -n "${msg} [Y/n]: " + + read ans + + case $ans in + "[Yy]" | "[Yy]es" | "" ) + return 0 + ;; + + * ) + return 1 + ;; + esac +} + + +if ask_yes_no "CAUTION: This script will break current '.bashrc' if it exists. Is it OK?"; then + cat <<"EOF" > "${HOME}/.bashrc" +SHELL_ENV="${HOME}/env/shell-env" + +source "${SHELL_ENV}/bashrc.sh" +EOF +fi diff --git a/install_zshrc.sh b/install_zshrc.sh new file mode 100755 index 0000000..327ad3c --- /dev/null +++ b/install_zshrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +ask_yes_no () { + msg="$1" + + echo -n "${msg} [Y/n]: " + + read ans + + case $ans in + "[Yy]" | "[Yy]es" | "" ) + return 0 + ;; + + * ) + return 1 + ;; + esac +} + + +if ask_yes_no "CAUTION: This script will break current '.zshrc' if it exists. Is it OK?"; then + cat <<"EOF" > "${HOME}/.zshrc" +SHELL_ENV="${HOME}/env/shell-env" + +source "${SHELL_ENV}/zshrc.sh" +EOF +fi From cda23c2226a0dd35e28baaae6bbcb0be259a98aa Mon Sep 17 00:00:00 2001 From: ysk Date: Thu, 12 Oct 2023 08:31:08 +0900 Subject: [PATCH 2/2] fix to show message after created --- install_bashrc.sh | 2 ++ install_zshrc.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/install_bashrc.sh b/install_bashrc.sh index 4a10a51..59e2f40 100755 --- a/install_bashrc.sh +++ b/install_bashrc.sh @@ -25,4 +25,6 @@ SHELL_ENV="${HOME}/env/shell-env" source "${SHELL_ENV}/bashrc.sh" EOF + + echo "${HOME}/.bashrc is created." fi diff --git a/install_zshrc.sh b/install_zshrc.sh index 327ad3c..2c4cad8 100755 --- a/install_zshrc.sh +++ b/install_zshrc.sh @@ -25,4 +25,6 @@ SHELL_ENV="${HOME}/env/shell-env" source "${SHELL_ENV}/zshrc.sh" EOF + + echo "${HOME}/.zshrc is created." fi