# oh-my-bash **Repository Path**: futurelei/oh-my-bash ## Basic Information - **Project Name**: oh-my-bash - **Description**: Sync the repo https://github.com/ohmybash/oh-my-bash - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2026-05-06 - **Last Updated**: 2026-05-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🛠️ Oh My Bash 安装与配置指南 本指南将引导你完成 **Oh My Bash** 的安装与基础配置。这是一个专为 **中国大陆用户** 优化的镜像仓库,旨在解决访问 GitHub 缓慢的问题。 --- ## 📖 项目简介 **Oh My Bash** 是一个开源的、社区驱动的 Bash 配置管理框架。它不会让你立刻变成 10 倍效率的开发者,但你会感觉像是的。 > **注意**:此仓库为镜像仓库(forked from anjingyuws/oh-my-bash),旨在加速中国大陆的网络访问。我会尽力与原仓库(GitHub)保持同步。仓库内的所有 URL 均已替换为 Gitee 地址。 --- ## 🚀 快速开始 ### 1. 环境要求 * Unix-like 操作系统(macOS 或 Linux) * 已安装 `curl` 或 `wget` * 已安装 `git` ### 2. 基本安装 在终端中运行以下任一命令即可安装。 #### 方式一:使用 curl ```bash bash -c "$(curl -fsSL https://gitee.com/futurelei/oh-my-bash/raw/master/tools/install.sh)" ``` #### 方式二:使用 wget ```bash bash -c "$(wget https://gitee.com/futurelei/oh-my-bash/raw/master/tools/install.sh -O -)" ``` **⚠️ 注意**: * 安装脚本会将现有的 `~/.bashrc` 备份为 `~/.bashrc.omb-[时间戳]`,然后替换为 Oh My Bash 的配置。 * 如果你的 `~/.bash_profile` 已存在,请确保其中包含 `source ~/.bashrc`。如果没有,请手动添加: ```bash if [[ -f ~/.bashrc ]]; then source ~/.bashrc fi ``` --- ## ⚙️ 使用方法 ### 1. 启用插件 (Plugins) Oh My Bash 自带大量插件(位于 `plugins/` 目录)。 编辑 `~/.bashrc` 文件,找到 `plugins=` 这一行,添加你需要的插件: ```bash # 示例:启用 git, bundler, osx 插件 plugins=(git bundler osx rake ruby) ``` **条件启用**(例如仅在 SSH 会话中启用): ```bash [ "$SSH_TTY" ] && plugins+=(tmux-autoattach) ``` ### 2. 切换主题 (Themes) Oh My Bash 拥有上百种主题。 编辑 `~/.bashrc`,修改 `OSH_THEME` 变量: ```bash # 默认主题 OSH_THEME="font" # 切换为 agnoster 主题(可能需要安装 Powerline 字体) OSH_THEME="agnoster" ``` **随机主题**: ```bash OSH_THEME="random" # 或者从指定列表中随机选择 OMB_THEME_RANDOM_CANDIDATES=("font" "powerline-light" "minimal") ``` --- ## 🔧 进阶配置 ### 1. 自定义安装目录 默认安装到 `~/.oh-my-bash`。如需更改,请在安装前设置环境变量: ```bash export OSH="$HOME/.dotfiles/oh-my-bash" bash -c "$(curl -fsSL https://gitee.com/futurelei/oh-my-bash/raw/master/tools/install.sh)" ``` ### 2. 无人值守安装 (自动化脚本) 适用于 Docker 或自动化部署,不会尝试切换默认 Shell: ```bash bash -c "$(curl -fsSL https://gitee.com/futurelei/oh-my-bash/raw/master/tools/install.sh)" --unattended ``` ### 3. 系统级安装 安装到 `/usr/local/share/oh-my-bash`,供所有用户使用: ```bash bash -c "$(curl -fsSL https://gitee.com/futurelei/oh-my-bash/raw/master/tools/install.sh)" --prefix=/usr/local # 用户需手动复制配置文件 cp /usr/local/share/oh-my-bash/bashrc ~/.bashrc ``` --- ## 🐍 提示符配置 在 `~/.bashrc` 中添加或修改以下变量: | 配置项 | 说明 | | :--- | :--- | | `OMB_PROMPT_SHOW_PYTHON_VENV=true` | 显示 Python 虚拟环境信息 | | `OMB_PROMPT_SHOW_SPACK_ENV=true` | 显示 Spack 环境信息 | | `OMB_USE_SUDO=false` | 禁止 Oh My Bash 内部使用 sudo | --- ## 🔄 更新与卸载 ### 更新 * **自动更新**:默认每几周提示一次。 * **禁用提示**:在 `~/.bashrc` 中加入 `DISABLE_UPDATE_PROMPT=true`。 * **手动更新**:运行命令 `upgrade_oh_my_bash`。 ### 卸载 如果你想离开我们,只需运行: ```bash uninstall_oh_my_bash ``` 这将移除 Oh My Bash 并恢复你原来的 `~/.bashrc` 配置。 --- ## 🤝 贡献与许可 * **许可证**:MIT License * **来源**:本项目最初由 @nntoan 从 Oh My Zsh 和 Bash-it 移植而来。 * **贡献**:欢迎提交 PR 或 Issue。 --- *Happy Coding!* 🎉