Cshell setenv: Too many arguments.

i have in c-shell

        set value_str ="one three"
        set line_seprator = ","
        set value_and_sperator = "$value_str$line_seprator"
        setenv STRING_CONCAT $STRING_CONCAT$value_and_sperator

and im getting error:

setenv: Too many arguments.

this is way i what to set global variable in the script , any idea why im getting the error?

You have built variable value_and_sperator (an odd spelling perhaps?) containing a space from the value of value_str . You did it correctly by using the quotes, but on the final line, you don't and so the setenv command will see three parameters which is illegal. Because you have not yet set a value for STRING_CONCAT , they are:-

  • The variable to set, i.e. STRING_CONCAT
  • one
  • three,

Use double quotes around $STRING_CONCAT$value_and_sperator and see if that helps.

Robin

1 Like