在这里找到了一些对我没有太大帮助的答案
ohad@Macintosh-2:/Volumes/develpment/global_constants (master *+)$ node_modules/.bin/mocha -w
bash: node_modules/.bin/mocha: /bin/csh: bad interpreter: Operation not permitted
该文件是
cat node_modules/.bin/mocha
#!/usr/bin/env node
/**
* This tiny wrapper file checks for known node flags and appends them
这不仅发生在这里,而且每次我尝试从我的电脑运行 bash 时都会发生。我是 bash 新手,对 linux 不太熟悉,有人能帮忙吗?
编辑:我正在使用 Osx。我试过
find ~ -exec xattr -d com.apple.quarantine {} 2> /dev/null \;
它还在运行..
尝试编辑并删除 .bash_profile 中的所有内容
export PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# Textmate's ruby
export TM_RUBY=rvm-auto-ruby
export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin/:/usr/local/mysql-5.1.58-osx10.6-x86_64/bin:$PATH"
#export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH"
export JAVA_HOME=/Library/Java/Home
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export GEM_EDITOR='mate'
export VBOX_IP="127.0.0.1"
PATH=$PATH:/usr/local/sbin
bind 'set completion-ignore-case on'
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
source ~/.git-completion.bash
# User specific environment and startup programs
function crc32 { cksum -o3 "$@"|ruby -e 'STDIN.each{|a|a=a.split;printf "%08X\t%s\n",a[0],a[2..-1].join(" ")}'; }
#required to get X11 working right (for ssh -X and gtk)
export DISPLAY=:0
#git
source ~/.git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
#modified (colourised) prompt
#export PS1='\h:\w \e[31m\u\e[0m$'
#export PS1='[\t] \h:\w \u\$ '
#export PS1='\u@\h:\w \$ '
#git-bash
# export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '
# ls aliases
# colors that "ls" uses.
export CLICOLOR=1
#export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:"
#export LS_COLORS='no=00:fi=00:di=01;34:ln=01;43;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32;41:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:'
LS_COLORS=''
LS_COLORS=$LS_COLORS:'no=0' # Normal text
LS_COLORS=$LS_COLORS:'fi=0' # Regular file
LS_COLORS=$LS_COLORS:'di=36' # Directory
LS_COLORS=$LS_COLORS:'ln=01;36' # Symbolic link
LS_COLORS=$LS_COLORS:'pi=33' # Named pipe
LS_COLORS=$LS_COLORS:'so=01;35' # Socket
LS_COLORS=$LS_COLORS:'do=01;35' # DO
LS_COLORS=$LS_COLORS:'bd=01;37' # Block device
LS_COLORS=$LS_COLORS:'cd=01;37' # Character device
LS_COLORS=$LS_COLORS:'ex=35' # Executable file
LS_COLORS=$LS_COLORS:'*FAQ=31;7' # FAQs
LS_COLORS=$LS_COLORS:'*README=31;7' # READMEs
LS_COLORS=$LS_COLORS:'*INSTALL=31;7' # INSTALLs
LS_COLORS=$LS_COLORS:'*.sh=47;31' # Shell-Scripts
LS_COLORS=$LS_COLORS:'*.vim=35' # Vim-"Scripts"
LS_COLORS=$LS_COLORS:'*.swp=00;44;37' # Swapfiles (Vim)
LS_COLORS=$LS_COLORS:'*.sl=30;33' # Slang-Scripts
LS_COLORS=$LS_COLORS:'*,v=5;34;93' # Versioncontrols
LS_COLORS=$LS_COLORS:'or=01;05;31' # Orphaned link
LS_COLORS=$LS_COLORS:'*.c=33' # Sources
LS_COLORS=$LS_COLORS:'*.C=33' # Sources
LS_COLORS=$LS_COLORS:'*.h=33' # Sources
LS_COLORS=$LS_COLORS:'*.cc=33' # Sources
LS_COLORS=$LS_COLORS:'*.py=33' # Sources
LS_COLORS=$LS_COLORS:'*.rb=33' # Sources
LS_COLORS=$LS_COLORS:'*.awk=33' # Sources
LS_COLORS=$LS_COLORS:'*.pl=33' # Sources
LS_COLORS=$LS_COLORS:'*.jpg=0;32' # Images
LS_COLORS=$LS_COLORS:'*.jpeg=0;32' # Images
LS_COLORS=$LS_COLORS:'*.JPG=0;32' # Images
LS_COLORS=$LS_COLORS:'*.gif=0;32' # Images
LS_COLORS=$LS_COLORS:'*.png=0;32' # Images
LS_COLORS=$LS_COLORS:'*.jpeg=0;32' # Images
LS_COLORS=$LS_COLORS:'*.ppm=0;32' # Images
LS_COLORS=$LS_COLORS:'*.pgm=0;32' # Images
LS_COLORS=$LS_COLORS:'*.pbm=0;32' # Images
LS_COLORS=$LS_COLORS:'*.tar=31' # Archive
LS_COLORS=$LS_COLORS:'*.tgz=31' # Archive
LS_COLORS=$LS_COLORS:'*.gz=31' # Archive
LS_COLORS=$LS_COLORS:'*.zip=31' # Archive
LS_COLORS=$LS_COLORS:'*.sit=31' # Archive
LS_COLORS=$LS_COLORS:'*.lha=31' # Archive
LS_COLORS=$LS_COLORS:'*.lzh=31' # Archive
LS_COLORS=$LS_COLORS:'*.rar=31' # Archive
LS_COLORS=$LS_COLORS:'*.arj=31' # Archive
LS_COLORS=$LS_COLORS:'*.bz2=31' # Archive
LS_COLORS=$LS_COLORS:'*.avi=35' # Video
LS_COLORS=$LS_COLORS:'*.mpg=35' # Video
LS_COLORS=$LS_COLORS:'*.mpeg=35' # Video
LS_COLORS=$LS_COLORS:'*.divx=35' # Video
LS_COLORS=$LS_COLORS:'*.xvid=35' # Video
LS_COLORS=$LS_COLORS:'*.mov=35' # Video
LS_COLORS=$LS_COLORS:'*.mp4=35' # Video
LS_COLORS=$LS_COLORS:'*.m4v=35' # Video
LS_COLORS=$LS_COLORS:'*.wmv=35' # VIdeo
LS_COLORS=$LS_COLORS:'*.mp3=37' # Audio
LS_COLORS=$LS_COLORS:'*.ogg=37' # Audio
LS_COLORS=$LS_COLORS:'*.wav=37' # Audio
LS_COLORS=$LS_COLORS:'*.au=37' # Audio
LS_COLORS=$LS_COLORS:'*.html=36' # HTML
LS_COLORS=$LS_COLORS:'*.htm=1;34' # HTML
LS_COLORS=$LS_COLORS:'*.php=1;45' # PHP
LS_COLORS=$LS_COLORS:'*.doc=1;34' # MS-Word
LS_COLORS=$LS_COLORS:'*.txt=1;34' # Plain/Text
LS_COLORS=$LS_COLORS:'*.o=1;36' # Object-Files
LS_COLORS=$LS_COLORS:'*.a=1;36' # Shared-libs
export LS_COLORS
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
clean(){ #various commands to clean files that are weirdly changed.
echo "running git checkout Gemfile.lock "
git checkout Gemfile.lock
echo "running rm dump.rdb "
rm dump.rdb
echo "Done cleaning"
}
cl(){
clean
}
startup(){ #start up commands
echo "redis"
sudo redis-server
echo "mongo"
sudo mongod
echo "rabbit"
rabbitmq-server
}
st(){
startup
}
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
if [ -f ~/bash_completion.d/knife ]; then
. ~/bash_completion.d/knife
fi
[ -s "/Users/ohad/.nvm/nvm.sh" ] && . "/Users/ohad/.nvm/nvm.sh" # This loads nvm
答案1
我认为你的命令是正确的xattr
。这个问题提供解释:
您是否碰巧在 TextEdit 中打开/保存了该文件?
可以引入文件系统元数据(隔离属性) 导致你描述的症状。
您运行的命令:
find ~ -exec xattr -d com.apple.quarantine {} 2> /dev/null \;
只会删除主目录 ( ) 下文件的隔离属性~
。您应尝试:
xattr -d com.apple.quarantine /Volumes/develpment/global_constants/node_modules/.bin/mocha
和/或将~
原始命令替换为您运行有困难的脚本的父目录之一。
答案2
“操作不允许”
有时“操作不允许”也意味着您正在尝试打开一个不允许的可执行文件。
您可以使用sudo chmod +x yourfile
您是否尝试过以用户身份根?sudo yourcommand
由于某些原因,当我使用 sudo 时,它并不总是有效。
所以你可以尝试一下sudo su
。
如果您不在 sudoers 文件中,只需使用su
then添加您即可visudo
。