Bash 完成错误 Mac OSX

Bash 完成错误 Mac OSX

我得到了

-bash: complete: bashdefault: invalid option name

当我启动终端时。有什么想法吗?我搞砸了什么?在哪里搞砸了?

跑步bash -x

+ '[' -n '\s-\v\$ ' ']'
+ PS1=\h:\w \u\$ 
+ shopt -s checkwinsize

和 'bash -lx'

+ bash -lx
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ export PATH
+ '[' /bin/bash '!=' no ']'
+ '[' -r /etc/bashrc ']'
+ . /etc/bashrc
++ '[' -n '\s-\v\$ ' ']'
++ PS1=\h:\w \u\$ 
++ shopt -s checkwinsize
+ export PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+ PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+ export DISPLAY=:0
+ DISPLAY=:0
+ [[ -s /Users/ed/.rvm/scripts/rvm ]]
+ source /Users/ed/.rvm/scripts/rvm
++ grep -q '^rvm ()'
+++ declare -f
++ [[ 1 -gt 0 ]]
++ [[ 0 -eq 0 ]]
++ [[ -f /etc/rvmrc ]]
++ [[ -f /Users/ed/.rvmrc ]]
++ [[ -z 1 ]]
++ [[ -z '' ]]
++ [[ 1 = \0 ]]
++ rvm_prefix=/Users/ed/.
++ echo /Users/ed/.
++ grep -vq '\(\/\|\.\)$'
++ rvm_prefix_needs_trailing_slash=1
++ [[ /Users/ed/. = \/\u\s\r\/\l\o\c\a\l ]]
++ [[ 1 = \0 ]]
++ [[ -z /Users/ed/.rvm ]]
++ [[ -d /Users/ed/.rvm ]]
++ [[ -f /Users/ed/.rvm/scripts/array ]]
++ source /Users/ed/.rvm/scripts/array
+++ [[ -n '' ]]
+++ __array_start=0
++ [[ -f /Users/ed/.rvm/scripts/utility ]]
++ source /Users/ed/.rvm/scripts/utility
++ [[ -f /Users/ed/.rvm/scripts/initialize ]]
++ source /Users/ed/.rvm/scripts/initialize
+++ [[ -n '' ]]
+++ [[ -n 2.05b.0(1)-release ]]
+++ shopt -s extglob
+++ [[ 1 -eq 0 ]]
+++ rvm_bin_path=/Users/ed/.rvm/bin
+++ rvm_man_path=/Users/ed/.rvm/man
+++ rvm_rc_files=/Users/ed/.bash_profile /Users/ed/.bashrc /Users/ed/.zshenv
+++ [[ -n '' ]]
+++ rvm_gems_cache_path=/Users/ed/.rvm/gems/cache
+++ export rvm_path rvm_bin_path rvm_gems_cache_path rvm_gemset_separator rvm_selfcontained
++ [[ -f /Users/ed/.rvm/scripts/version ]]
++ source /Users/ed/.rvm/scripts/version
++ [[ -f /Users/ed/.rvm/scripts/selector ]]
++ source /Users/ed/.rvm/scripts/selector
++ [[ -f /Users/ed/.rvm/scripts/cli ]]
++ source /Users/ed/.rvm/scripts/cli
++ [[ -f /Users/ed/.rvm/scripts/cd ]]
++ source /Users/ed/.rvm/scripts/cd
+++ [[ 1 -ne 0 ]]
+++ [[ -n '' ]]
+++ complete -o bashdefault -o default -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd
bash: complete: bashdefault: invalid option name
++ [[ -f /Users/ed/.rvm/scripts/override_gem ]]
++ source /Users/ed/.rvm/scripts/override_gem
+++ [[ 0 -eq 0 ]]
+++ awk '/:/{printf $NF"."}' /Users/ed/.rvm/lib/VERSION.yml
++ rvm_version=1.0.21.
++ export rvm_version=1.0.21
++ rvm_version=1.0.21
++ alias 'rvm-restart=source '\''/Users/ed/.rvm/scripts/rvm'\'''
++ command -v ruby
++ command -v ruby
++ grep -v rvm
++ [[ -s /Users/ed/.rvm/environments/default ]]
++ source /Users/ed/.rvm/environments/default
+++ export PATH=/Users/ed/.rvm/gems/ruby-1.8.7-p302/bin:/Users/ed/.rvm/gems/ruby-1.8.7-p302@global/bin:/Users/ed/.rvm/rubies/ruby-1.8.7-p302/bin:/Users/ed/.rvm/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+++ PATH=/Users/ed/.rvm/gems/ruby-1.8.7-p302/bin:/Users/ed/.rvm/gems/ruby-1.8.7-p302@global/bin:/Users/ed/.rvm/rubies/ruby-1.8.7-p302/bin:/Users/ed/.rvm/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+++ rvm_path=/Users/ed/.rvm
+++ export rvm_path
+++ RUBY_VERSION=ruby-1.8.7-p302
+++ export RUBY_VERSION
+++ GEM_HOME=/Users/ed/.rvm/gems/ruby-1.8.7-p302
+++ export GEM_HOME
+++ GEM_PATH=/Users/ed/.rvm/gems/ruby-1.8.7-p302:/Users/ed/.rvm/gems/ruby-1.8.7-p302@global
+++ export GEM_PATH
+++ BUNDLE_PATH=/Users/ed/.rvm/gems/ruby-1.8.7-p302
+++ export BUNDLE_PATH
+++ MY_RUBY_HOME=/Users/ed/.rvm/rubies/ruby-1.8.7-p302
+++ export MY_RUBY_HOME
+++ IRBRC=/Users/ed/.rvm/rubies/ruby-1.8.7-p302/.irbrc
+++ export IRBRC
+++ rvm_ruby_string=ruby-1.8.7-p302
+++ export rvm_ruby_string
+++ unset rvm_gemset_name
+++ unset MAGLEV_HOME
++ __rvm_conditionally_add_bin_path
++ grep -vqF '/Users/ed/.rvm/bin '
++ printf '/Users/ed/.rvm/gems/ruby-1.8.7-p302/bin /Users/ed/.rvm/gems/ruby-1.8.7-p302@global/bin /Users/ed/.rvm/rubies/ruby-1.8.7-p302/bin /Users/ed/.rvm/bin /opt/local/bin /opt/local/sbin /bin /sbin /usr/bin /usr/sbin'
++ return 0
++ unset rvm_prefix_needs_trailing_slash rvm_bin_path rvm_man_path rvm_rc_files rvm_gems_path rvm_gems_cache_path rvm_interactive_flag rvm_gems_path rvm_project_rvmrc_default rvm_gemset_separator
++ [[ 0 -gt 0 ]]

答案1

你的问题似乎在于

+++ complete -o bashdefault -o default -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd
bash: complete: bashdefault: invalid option name

尝试在某个启动脚本中找到该complete …行。(在您的主目录中查找名为 、 或 的文件.bash_profile.bash_login.profile如果.bashrc您需要该行,则必须弄清楚为什么它会抛出“无效选项名称”错误。我认为这complete是一个bash内置命令,因此您应该bash通过运行 来检查手册页man bash

当然,如果您不知道它为什么在那里,那么最好在它前面加上 # 符号将其注释掉。

相关内容