Assigning expression value to tcsh variables

Hi All,

I have a tcsh script as:

#!/usr/bin/csh -x

set packsName=$(awk -F'[=.]' '/^execute.*=true/{print $2}' ExecutePacks.config)

for var in $packsName
do
echo "printed $var"
done

I want to assign the value which is returned by awk function to the variable called packsName.
How do I do that?

One more thing,
Is syntax of for loop in 'ksh' and 'tcsh' different?

Thanks in advance!

Hi.

I don't know about tcsh, but AFAIK csh does not support $(...) command substitution. Use back-quotes ( ` ... ` ) instead.

The for-loop syntax in csh is not the same as in ksh.

foreach var($packsName)
  echo "printed $var"
end

Thanks it also worked in tcsh!!