0
#!/bin/csh
set passFail_file = "name"

set numErrs = `/bin/grep -c ERROR $passFail_file`
echo "numErrs is $numErrs"        # displays numErrs is 0, which isn't always correct
set dirLocale = `/bin/sed q $passFail_file`   #capture line 1 in file, which is nonBlank
echo "dirLocale is $dirLocale"   # displays: dirLocale is

When I run the above script, I can not get dirLocale to assign. Is there an equivalent of eval in csh? What would be the syntax? I'm thinking I'm missing out on the mix of backquotes, and order of operations.

Mat
  • 202,337
  • 40
  • 393
  • 406
frododot
  • 127
  • 2
  • 16
  • `#!/bin/csh` should probably be `#!/bin/csh -f`. Yes, csh has `eval`. Note that there's a known bug in some versions of csh, at least on Ubuntu; see https://bugs.launchpad.net/ubuntu/+source/csh/+bug/1739505. With this bug, `eval` always (I think) dies with a segmentation fault. This bug does not affect tcsh. – Keith Thompson Apr 18 '19 at 19:09
  • The bug is caused by a Debian-specific patch to csh (bsd-csh), so it likely shows up with csh on any Debian-based system. (`/bin/csh` may be either bsd-csh or tcsh; tcsh is not affected.) – Keith Thompson Jul 26 '19 at 21:21

1 Answers1

0

System was acting strangely. All is well, using the above syntax. Question closed. Thank you.

frododot
  • 127
  • 2
  • 16