6

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:

  export PATH="$PATH:$MODEL_TECH"

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

  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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
reinhard
  • 71
  • 1
  • 1
  • 4

5 Answers5

5

Drop the =

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

From the man page for 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.
codaddict
  • 445,704
  • 82
  • 492
  • 529
5

Put curly braces around the variable names:

setenv PATH ${PATH}:${foo}

or use this form:

set path = ($path $foo)
Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
  • 4
    Right. csh/tcsh uses the `:` character for modifiers; for example `$var:t` gives you the root of the filename `$var` (by deleting the `.whatever` extension). If you write `"$PATH:$MODEL_TECH"` the shell thinks the '$' is part of a modifier for $PATH (which it doesn't recognize). The curly braces separate the name from the following `':'`. The `set path = ...` form sets the corresponding shell variable `$path`, which is tied to the environment variable `$PATH`. `man tcsh` for more information. – Keith Thompson Jul 30 '11 at 20:06
  • Although not stated, an explicit string will work as well e.g. `setenv PATH ${PATH}:/foo/bar` – Samuel Harmer Jul 19 '13 at 07:53
2

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

Hank Gay
  • 70,339
  • 36
  • 160
  • 222
  • Great, that works fine but it seems there are still problems when I wanna set a path, I added this to my post. I get then a bad modifier error. – reinhard Mar 07 '11 at 11:28
  • tcsh syntax for setting the PATH is different than sh variants. Do you have a good reason for using tcsh? Unless there is a *very* compelling reason, it's probably better to continue using an sh-variant. – William Pursell Mar 07 '11 at 11:31
  • @reinhard Is `$MODEL_TECH` set? – Hank Gay Mar 07 '11 at 14:29
0

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

setenv PATH $PATH":$NEWPATH"
Rams
  • 1
-1

If it's not working use this:

setenv PATH ${PATH}:/.../../../
eebbesen
  • 5,070
  • 8
  • 48
  • 70
katy
  • 181
  • 1
  • 3
  • 13