2

I am trying to install a program on my brand-new CentOs. The installation requires setenv, which apparently does not work, not even in the tcsh shell.

Can anyone give me some advice?

[Anna@anna xd-demo] ./setup.csh

Configuring shell for the XD2006 :
./setup.csh: line 7: setenv: command not found
./setup.csh: line 8: setenv: command not found
./setup.csh: line 9: setenv: command not found
./setup.csh: line 10: setenv: command not found
./setup.csh: line 11: syntax error near unexpected token `('
./setup.csh: line 11: `set path=( $XD_ROOT/bin $XD_ROOT/lib/xd $XD_ROOT/lib/xdgraph $path )'
[Anna@anna xd-demo]$ echo $shell
/bin/tcsh
1
  • echo $shell should return nothing. What you want is $SHELL. So please make sure you have (t)csh correctly installed and running.
    – schaiba
    Jul 10 '14 at 12:32
0

This script is not actually being executed by tcsh. You ran the command ./setup.csh from tcsh, but that is a separate command, executed in its own process. There is no reason from what you've shown that the script would be executed in tcsh. The command setenv is not found because some different interpreter is executing the script. As further evidence the error messages are consistent with bash, dash and ksh's error message formatting, but not with tcsh's.

This is a bug in the script. It should start with a shebang line indicating which interpreter (shell) the script is designed for. A tcsh script should start with the line

#!/usr/bin/env tcsh

Add this line (it must be the very first line; note that the file must not have Windows line endings, so take care if you use a Windows editor, or better, use a Linux editor). Alternatively, if you prefer not to edit the file, you can invoke tcsh explicitly:

tcsh ./setup.csh

You can do that from any shell, you don't have to use tcsh interactively if you don't want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.