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_at_cognex.com www.cognex.com
cell: (617) 470-0034
===================================================
Received on Fri May 10 2002 - 14:41:33 NZST