how can i check in csh if command found or not found ?

hello all

im trying to use in sun Solaris the information received from the top command

now i several machines that dont have install the top program so when im running the script im geting error

saying after im running this code :

set MemoryInfo = `top | grep Memory`
      if ( $status != 1 ) then
        echo $MemoryInfo
      endif


top: Command not found

how can i prevent the printing of any error coming from executing unix application with tcsh ?

usually top would be available at /usr/bin/top ( If you are sure, there is no top available, you can leave it )

to supress any error, if you are sure you dont need them for debugging purpose then

anycommand 2>/dev/null

Don't use [t]csh for scripting.

    http://www.grymoire.com/Unix/CshTop10.txt
    http://www.grymoire.com/Unix/Csh.html\#uh-0
    http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/