Hello and good afternoon,

 : Is there some sort of Bourne or Bash shell equivalent to #if 0 ...
 : #endif?  I've got a group of commands in my script that take a long
 : time to execute, so I'd like to temporarily disable them.

Those are macros, sometimes called defines, sometimes called ifdefs.  
Unless you are (pre)processing your shell, no there really isn't 
something similar, however, you could simply use an if block.

Insert this around the code you do not want to run (did you know 
that there's a /bin/false and a /bin/true):

  if false; then
      ... code you want to skip
  fi

Then, naturally, you'll want to make that a shell variable, which 
means you probably get to use 'test'.  Note that 'test' is 
sometimes also written more portable as '[':

  SKIP_STUFF=please
  if test -z "$SKIP_STUFF" ; then
      ... code you still want to skip
  fi

Then, when you are done with your temporary disability....

  unset SKIP_STUFF
  if test -z "$SKIP_STUFF" ; then
      ... code you desperately wish to see running
  fi

Happy trails!

-Martin

-- 
Martin A. Brown
http://linux-ip.net/
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to