command substitution problems with csh using grep

I am trying to set a command into a variable in a csh script using command substituion with ``. I am having a problem with ps command combined with grep. The command is as follows (shows processes running with the word gpts in them).

/usr/ucb/ps axwww | grep gpts

this works fine at the command prompt but I get an error "set: No match" when trying to use it in a csh script as follows

set PS1=`/usr/ucb/ps axwww | grep gpts`
echo $PS1

It works fine for other commands such as ls -la | wc, entered as follows

set LIS=`ls -la | wc`
echo $LIS

Anyone with any ideas with what's wrong with the first command? I have tried substituting a variable for gpts but that didn't work either

$PS1 is defined as the primary prompt for most shells I know of --- change your variable name and check again

The prompt variable is csh's equivalent of PS1.

PS1 is the primary prompt for Bourne-based shells.

When you run your ps command at the command line, you'll see that there is a "?" somewhere in the output. This is confusing csh.

Before you call the ps command in your script, include the line:

set nonomatch

Then it should work. Personally, I'd say ditch csh and use a Bourne-based shell for scripting.

Cheers
ZB