From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Cohen, Andy" Newsgroups: gmane.os.tru64.managers Subject: how to dynamically add/remove a comment Date: Fri, 10 May 2002 10:41:16 -0400 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <6AF24836F3EB074BA5C922466F9E92E104DD84D5@prince.pc.cognex.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: main.gmane.org 1021042887 20426 127.0.0.1 (10 May 2002 15:01:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 10 May 2002 15:01:27 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.20.101]) by main.gmane.org with smtp (Exim 3.33 #1 (Debian)) id 176Bte-0005JL-00 for ; Fri, 10 May 2002 17:01:26 +0200 Original-Received: (qmail 24756 invoked by uid 5); 10 May 2002 14:41:29 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 24748 invoked from network); 10 May 2002 14:41:29 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (134.167.3.119) by 0 with SMTP; 10 May 2002 14:41:29 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.1 #39060) with ESMTP id <0GVW008EBGT4YS@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 10 May 2002 10:41:28 -0400 (EDT) Original-Received: from cambridge1-smrly1.gtei.net (cambridge1-smrly1.gtei.net [199.94.215.245]) by emroute1.cind.ornl.gov (PMDF V6.1 #39060) with ESMTP id <0GVW00FG3GT28Z@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 10 May 2002 10:41:27 -0400 (EDT) Original-Received: from cognex-cp.cognex.com (cognex-cp.cognex.com [198.232.30.75]) by cambridge1-smrly1.gtei.net (Postfix) with SMTP id 4106E7912 for ; Fri, 10 May 2002 14:41:21 +0000 (GMT) Original-To: "tru64-unix-managers \(E-mail\)" X-Mailer: Internet Mail Service (5.5.2650.21) Xref: main.gmane.org gmane.os.tru64.managers:140 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:140 Hi, I'm writing a korn-shell script and I want to be able to be able to run it in a 'debug' type mode. That is I want to optionally pass in a parameter (e.g., 'debug') that will force the script to comment out certain lines that I don't want to perform. Without this parameter the lines will execute, with this parameter the lines won't be executed. The script is setup to be run either with or without the parameter ($1). If $1 = 'debug' then a variable (SHELL_DEBUG) is set to '# ' (ksh comment). If $1 is not 'debug' (i.e., absent) then SHELL_DEBUG is set to "" (nothing, null). For the lines that I want to be able to comment out with this parameter I put ${SHELL_DEBUG} at the beginning of the line (e.g., $SHELL_DEBUG ./cp_hb_archlogs_$ORACLE_SID.sh). This part seems to be working ok. The problem is that when run the command line processor doesn't seem to recognize the "# " as a legitimate comment. If I issue 'set -x' I get: + # compress -v *.dbf ./HOT_BACKUPS_734_MULTI_DB.sh[231]: #: not found so the '#' is getting added to the beginning of the line but then an error is generated "#: not found". Am I doing something wrong? Is this even possible? Am I on the right path or is there some other approach I should take (i.e., 'case' or 'if' branching)? Thanks much! Andy =================================================== Andy Cohen Database Systems Manager COGNEX Corporation (508) 650-3079 Fax: (508) 650-3337 andy.cohen@cognex.com www.cognex.com cell: (617) 470-0034 ===================================================