Index: trunk/ippTasks/detrend.stack.pro
===================================================================
--- trunk/ippTasks/detrend.stack.pro	(revision 12368)
+++ trunk/ippTasks/detrend.stack.pro	(revision 12369)
@@ -148,9 +148,14 @@
     options $pageName
 
+    $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA $ARGS
+    if ($WORKDIR != NULL)
+      $run = $run --workdir $outroot
+    end
+
     # create the command line
     if ($VERBOSE > 1)
-      echo command detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --workdir $outroot $ARGS
+      echo command $run
     end
-    command detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --workdir $outroot $ARGS
+    command $run
   end
 
