1234567891011121314151617181920212223242526272829 |
- #!/bin/bash
- declare -A bashrc_files
- bashrc_files=( ["home"]=".bashrc-home" ["work"]=".bashrc-work" )
- switch_bashrc() {
- local choice=$1
- if [[ -n "${bashrc_files[$choice]}" ]]; then
-
- cp "${HOME}/${bashrc_files[$choice]}" "${HOME}/.bashrc"
- echo "Переключено на ${bashrc_files[$choice]}."
- else
- echo "Неверный выбор. Пожалуйста, выберите 'home' или 'work'."
- fi
- }
- if [[ $# -ne 1 ]]; then
- echo "Использование: $0 {home|work}"
- exit 1
- fi
- switch_bashrc "$1"
|