linux - .zshrc 配置文件语法错误

标签 linux macos shell terminal zshrc

我的 .zshrc 文件中某处出现语法错误,但我似乎找不到它。

我收到此错误消息:

.zshrc:49: bad assignment

这是我的 .zshrc 文件:

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"

# Example aliases
alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...

alias g2sites = "cd /Users/MYNAME/Dropbox/Development" #<< THIS IS THE LINE
alias g2work = "cd /Users/MYNAME/Dropbox/Development/Work"

questino 中的行是上面的倒数第二行。我的错误可能来自该行之前的语法,但我找不到它。

你看到我哪里做错了吗?

最佳答案

从别名命令中删除空格。正确的语法是

eeyore% alias g2sites = "cd /Users/MYNAME/Dropbox/Development"
zsh: bad assignment
eeyore% alias g2sites="cd /Users/MYNAME/Dropbox/Development" 
eeyore% 

关于linux - .zshrc 配置文件语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19920019/

相关文章:

c++ - 如何使用 C++ 不使用 system() 删除除最后 10 个文件之外的所有文件

xcode - OS X 10.7 : how to install XCode 4

javascript - 如何使用脚本编辑器和 JavaScript 访问 Chrome 事件选项卡 URL

oracle - 使用 BASH 脚本假脱机 CSV 文件 |生成的 CSV 中的输出错误

linux - 如何从命令行从 Linux 服务器下载文件?

c - 接收每个组播数据包两次 Onload?

java - spring-boot 无法在 docker 中启动

shell - 如何使用 sed 将字符串中的逗号替换为 "\,"

linux - 应用程序网关 - 调用后端服务(Linux 应用程序服务)时出现 404

Python:与 MacOS 相比,Scipy 在 Windows10 上非常慢