bash: ~/.bash_profile: 没有那个文件或目录

标签 bash

<分区>

我一直收到这个错误:

bash: ~/.bash_profile: No such file or directory

这是我的 bash_profile:

alias ngrok=/Users/mmahalwy/Desktop/Code/ngrok

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

alias ls='ls -GFh'

function prompt {
  local BLACK="\[\033[0;30m\]"
  local BLACKBOLD="\[\033[1;30m\]"
  local RED="\[\033[0;31m\]"
  local REDBOLD="\[\033[1;31m\]"
  local GREEN="\[\033[0;32m\]"
  local GREENBOLD="\[\033[1;32m\]"
  local YELLOW="\[\033[0;33m\]"
  local YELLOWBOLD="\[\033[1;33m\]"
  local BLUE="\[\033[0;34m\]"
  local BLUEBOLD="\[\033[1;34m\]"
  local PURPLE="\[\033[0;35m\]"
  local PURPLEBOLD="\[\033[1;35m\]"
  local CYAN="\[\033[0;36m\]"
  local CYANBOLD="\[\033[1;36m\]"
  local WHITE="\[\033[0;37m\]"
  local WHITEBOLD="\[\033[1;37m\]"
  local RESETCOLOR="\[\e[00m\]"

  export PS1="\n$RED\u $PURPLE@ $GREEN\w $BLUE[\#] → $RESETCOLOR"
  export PS2="| → $RESETCOLOR"
}

# prompt

export PATH=/usr/local/bin:$PATH

source ~/.git-completion.bash

if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi


source ~/.profile
source /Users/mmahalwy/.iterm2_shell_integration.bash

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

最佳答案

Bash 有 ~/.profile 而不是 ~/.bash_profile

~/.profile 的内容:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

关于bash: ~/.bash_profile: 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26289176/

相关文章:

linux - od --width=x 选项不起作用。我的路径似乎是正确的。

linux - 将发送电子邮件脚本添加到 pingall bash 脚本

linux - 在同一行用 SED 多次出现替换

macos - Mac OSX - 允许用户通过 GUI 或提示符在 shell 脚本中输入

java - Linux cp 命令在 Java ProcessBuilder 中不起作用

linux - 用于从 2 个不同文件中获取相同行的 bash 脚本

git - 在脚本中捕获 git post-receive 错误

arrays - Bash:将数组元素值传递给变量时出现 "invalid number"错误

regex - 管道分隔的文件,其中有空条目;转换为制表符分隔的,中间用'<empty>'

linux - 批量重命名图片为文件夹名+序号