Transmission of a variable

Hi
i have a problem with an part of a script - it`s not running!!!!
i think the problem is the delivery of a variable !!!..... and i am not able to fix it !!!!
i set an variable with a "grep", and with the result i will define with a find command a new variable
the second variable is zero and not working
in a shell (csh) environment are the command no problem and working

##############

set abaqus_inc_modell_name = `egrep -i "include," $abaqus_inp_fil_gef | awk -F"*" '{if($2~"INCLUDE"){print $0}}' | awk -F"=" '{if($2~"Modell_") {print $2}}'| awk -F"Modell_" '{print "Modell_"$2}'`
 set abaqus_include_fil_gef = `find $dirglob -name "$abaqus_inc_modell_name"`

##############

i can´t find the Problem !!!!

Welcome on board !

In order to be of some help, we need to know a bit more with what we are dealing with:
Architecture
OS and level
Shell used

Do you mean by just typing csh your script works but not otherwise?

You have a lot of variables to be set in the snippet you showed us where are they set?

Hi vbe
thank you for your request
architecture linux redhat rl 6
i use a cshell
the snippet is a short part of a shell-script. i set the most variables earlier...
and if i try to print there is no problem......
in the first line i define a variable with the command "egrep......" ......this line is working !!! i proofed it with printing the variable
but the definition of the second variable " abaqus_include_fil_gef" ist not working, because if i try to print variable it is zero!!!!

thank you for yor help

What about $dirglob ?
Why is your variable between double quotes when other looking the same are not?

Oh I know nothing about csh except it doesn't work like sh, ksh etc... I used tcsh about 30years ago and was discouraged by its syntax...

1 Like

to add to what @vbe has said about csh.
In general Csh Programming Considered Harmful
Read this link and this as well.
If you still insist on using csh, find out what csh's equivalent to ksh/bash set -v is for debugging.
From man bash:

-v      Print shell input lines as they are read.

Honestly I don't think you'll get much "traction" on this forum on the csh-related questions...

sh:

#debug on
set -x

#verbose on
set -v

#debug off
set +x

#verbose off
set +v

csh:

#debug on
set echo

#verbose on
set verbose

#debug off
unset echo

#verbose off
unset verbose

Regarding invocation the csh is like the sh

csh -x ... runs with debug on
csh -v ... runs with verbose on
csh -n ... runs in test mode (syntax check)

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.