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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5219004/
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-05 03:09:27  来源:igfitidea点击:

SETENV: Bad : modifier in $ ($)

linuxtcshsetenv

提问by reinhard

I am using the tcsh terminal in Linux. In the other terminal I normally used I set the path to some license file as follows:

我在 Linux 中使用 tcsh 终端。在我通常使用的另一个终端中,我将路径设置为某个许可证文件,如下所示:

  export PATH="$PATH:$MODEL_TECH"

Tcsh shell does not recognise this command so I tried the following:

Tcsh shell 无法识别此命令,因此我尝试了以下操作:

  setenv PATH "$PATH:$MODEL_TECH"
  set PATH "$PATH:$MODEL_TECH"
  setenv PATH=("$PATH:$MODEL_TECH")

But then I always get the following error:

但后来我总是收到以下错误:

Bad : modifier in $ ($).

坏:$ ($) 中的修饰符。

What be also great if someone could help me here out quickly, tried quite a few combinations but nothing works.

如果有人能快速帮助我,那也太好了,尝试了很多组合但没有任何效果。

回答by codaddict

Drop the =

放下 =

setenv LICENSE_FILE "/usr/local/softwarex/license.dat"

From the man page for tcsh:

从 tcsh 的手册页:

   setenv [name [value]]

   Without  arguments, prints the names and values of all environ‐
   ment variables.  Given name, sets the environment variable name
   to value or, without value, to the null string.

回答by Hank Gay

Try setenv LICENSE_FILE /usr/local/softwarex/license.dat. This should be documented in the manpage somewhere on your system, so try reading up in man tcsh; tcshis a very different beast from bashand friends. If the relevant manpage isn't available on your system for some reason, here's the first man tcshI found.

试试setenv LICENSE_FILE /usr/local/softwarex/license.dat。这应该记录在man您系统上某处的页面中,因此请尝试阅读man tcshtcsh是一个非常不同的野兽bash和朋友。如果由于man某种原因相关页面在您的系统上不可用,这是man tcsh我找到的第一个页面。

回答by Paused until further notice.

Put curly braces around the variable names:

在变量名周围放置花括号:

setenv PATH ${PATH}:${foo}

or use this form:

或使用此表格:

set path = ($path $foo)

回答by Rams

On a tcsh shell the path or any environment variable can be appended as below:

在 tcsh shell 上,路径或任何环境变量都可以附加如下:

setenv PATH $PATH":$NEWPATH"

回答by katy

If it's not working use this:

如果它不起作用,请使用以下命令:

setenv PATH ${PATH}:/.../../../