Linux 坏:$ (.) 中的修饰符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8805839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:00:35  来源:igfitidea点击:

Bad : modifier in $ (.)

linuxshellunix

提问by Sijith

I want to set environment variable in linux and did the same by giving command

我想在 linux 中设置环境变量并通过给出命令来做同样的事情

 export PATH=$PATH:.

But getting error Bad : modifier in $ (.).

但是得到错误错误:$ (.) 中的修饰符。

Can some one help this. I tried with bash shell and ksh

有人可以帮忙吗。我尝试使用 bash shell 和 ksh

回答by Mithrandir

You might want to try this:

你可能想试试这个:

export PATH="${PATH}:."

I don't like having the current directory in the path, but at the end it's fairly safe.

我不喜欢在路径中包含当前目录,但最终它是相当安全的。

回答by Johnsyweb

Bad : modifier in $ (.).

This is not a Basherror, nor is it from Ksh: it's from C-shell or one of its clones such as Tcsh.

这不是Bash错误,也不是来自Ksh:它来自 C-shell 或其克隆之一,例如Tcsh

You want:

你要:

setenv PATH ${PATH}:.

But you should not put .in your ${PATH}, it's a well-known security risk.

但是你不应该把.你的${PATH},它是一个众所周知的安全风险。

回答by user1767754

Dont forget to escape the colon

不要忘记逃脱冒号

setenv PYTHONPATH $PYTHONPATH\:/disk1/mypath