-bash:导出:`=':不是有效的标识符 [英] -bash: export: `=': not a valid identifier

查看:447
本文介绍了-bash:导出:`=':不是有效的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次打开终端时,都会出现以下错误:

Every time I open my terminal I get the error below:

Last login: Sun Aug  4 17:23:05 on ttys000
-bash: export: `=': not a valid identifier
-bash: export: `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier
-bash: export: `=': not a valid identifier
-bash: export: `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier

这是我的export输出:

Calvin:~ sunkehappy$ export
declare -x Apple_PubSub_Socket_Render="/tmp/launch-4lEZNa/Render"
declare -x Apple_Ubiquity_Message="/tmp/launch-ukGAv5/Apple_Ubiquity_Message"
declare -x COMMAND_MODE="unix2003"
declare -x HOME="/Users/sunkehappy"
declare -x LANG="zh_CN.UTF-8"
declare -x LOGNAME="sunkehappy"
declare -x OLDPWD
declare -x PATH="/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
declare -x PWD="/Users/sunkehappy"
declare -x SECURITYSESSIONID="186a4"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/tmp/launch-YAEryC/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="309"
declare -x TERM_SESSION_ID="B134A404-D87F-4BB9-8A08-55F8CE923339"
declare -x TMPDIR="/var/folders/kt/pfw99tps22gg2019vz8k1zcm0000gn/T/"
declare -x USER="sunkehappy"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:25:52"

推荐答案

这样做时,您不能在=符号周围放置空格:

You cannot put spaces around the = sign when you do:

export foo=bar

删除您拥有的空间,您应该会很好.

Remove the spaces you have and you should be good to go.

如果您输入:

export foo = bar

外壳程序会将其解释为输出三个名称的请求:foo=bar. =不是有效的变量名,因此命令失败.变量名称,等号,其值不能用空格分隔,以便将它们作为同时赋值和导出处理.

the shell will interpret that as a request to export three names: foo, = and bar. = isn't a valid variable name, so the command fails. The variable name, equals sign and it's value must not be separated by spaces for them to be processed as a simultaneous assignment and export.

这篇关于-bash:导出:`=':不是有效的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆