A couple of things.
#1 backtick the du command
#2 Use parens in the if statement
#3 add an 'endif' for the if statement
#4 fix the logic of the if statement. it is backwards.
I chose to switch which variable was used for what as the names made more sense to me that way.
#5 the script needs some work to make it more robust.
such as: check if the file exists, have a delay between checks, possible some exit condition, ...
Code:
#!/bin/csh
echo Enter a file name
set file aFILE = $< ##Name of file
echo enter a size in kilobytes to monitor
set SIZETOMON = $< ##Size value that's input by user
set SIZE = `du -k $aFILE | sed s/$aFILE//g` ##Size of the file that the user wishes to monitor
while (1)
if ($SIZE > $SIZETOMON) then
echo ALERT: File size is greater than $SIZETOMON
endif
end