09-10-2001
Well when two commands are linked together by && the second one is executed only if the first succeeds. So something like:
[ $DEBUG = y ] && echo DEBUG is set >&2
will echo "DEBUG is set" if and only if $DEBUG is equal to y. It's a one line "if" statement. The >&2 sends the output of the echo to stderr rather than stdout.
"set -x" will always succeed. So the second && is a way to do two statements based on the results of the first test. I think it's poor syntax and I would use:
[ "$DEBUG" = Y ] && { set -x ; echo "enter tablespace_end_backup" >&2 ; }
Of course, you can strongly argue for a full "if" statement in this case, but many programmers (including me) try to keep debug statements to one like so they can easily be commented out to improve performance.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello and Good day to all.
Im having a problem here and would like to know if there is any solution that could overcome my problem.
I have changed from bash to csh (c-shell) yesterday on my Linux 7.2. When i do $echo $SHELL i can see the output /bin/csh which means ihave succesfully landed on... (4 Replies)
Discussion started by: ###1tomato
4 Replies
2. UNIX for Advanced & Expert Users
Dear Members;
I changed ,by mistake ,the root shell in /etc/passwd and logged out. Thereafter, I can no more have a prompt when trynig to log in as root.
How to solve this pb ?
Regards :confused: (8 Replies)
Discussion started by: oss
8 Replies
3. UNIX for Dummies Questions & Answers
What are the different type of shell available in UNIX and how to change the shell?
just this 2 question pls help mi (4 Replies)
Discussion started by: yeah016
4 Replies
4. Shell Programming and Scripting
hi,
can any one tell a solution for the following :
I want to append 10 spaces and a string say "ok" to 12 digit number which is stored in a varialbe & display using shell script. (1 Reply)
Discussion started by: Sandeep Kale
1 Replies
5. Shell Programming and Scripting
Hi all,
until yesturday grep command was running in KSH ....
I was executing this command
ls -l | grep *.sh
But today its not working at all ...
Should I check any of the setting ...
I am not getting whats the problem ...
I have relogged to unix box but it didn't... (14 Replies)
Discussion started by: dhananjayk
14 Replies
6. Shell Programming and Scripting
Hi,
My sheel script has below statement:
if; then
When I run iam getting the below error:
-bash: syntax error near unexpected token `then'
What is wrong with that statement:
Plz help me. (2 Replies)
Discussion started by: pradeep_script
2 Replies
7. Shell Programming and Scripting
Hello!
Can you please help me on a lab at school:
I have to to write a shell program which reads all .C files from the current directory and prints for each file how many '#define' directives it has and for each macro defined how many times is it used in that file.
Can you suggest how can i... (1 Reply)
Discussion started by: dark_knight
1 Replies
8. Shell Programming and Scripting
hi...i create a script which reads data from file and compare that the data which is entered by me through keyboard...i can easily read first two contents of file..i am facing the problem to read other contents..
structure of my file is
username:password:username1:password1.......and so on
... (1 Reply)
Discussion started by: shubhig15
1 Replies
9. Shell Programming and Scripting
problem:
I give the source of a c program.. is required to indicate how many times is called each function defined in the program and line number
there is a call.
let's say i have lab2.c:
float dist(int *a,int *b,int n){
int i=0;
double d=0;
for (i=1;i<=n;i++){
d+=pow((a-b),2);
}... (4 Replies)
Discussion started by: sherpeledenis
4 Replies
10. UNIX for Dummies Questions & Answers
this picture for print You didn't do the question. Go back.
if $1 = 0
but until now it give me this message
what i should be do ?
http://img717.imageshack.us/img717/6137/eeevb.jpg (2 Replies)
Discussion started by: NeeZaaR
2 Replies
LEARN ABOUT SUSE
log::log4perl::resurrector
Resurrector(3) User Contributed Perl Documentation Resurrector(3)
NAME
Log::Log4perl::Resurrector - Dark Magic to resurrect hidden L4p statements
DESCRIPTION
Loading "use Log::Log4perl::Resurrector" causes subsequently loaded modules to have their hidden
###l4p DEBUG(...)
###l4p INFO(...)
...
statements uncommented and therefore 'resurrected', i.e. activated.
This allows for a module "Foobar.pm" to be written with Log4perl statements commented out and running at full speed in normal mode. When
loaded via
use Foobar;
all hidden Log4perl statements will be ignored.
However, if a script loads the module "Foobar" after loading "Log::Log4perl::Resurrector", as in
use Log::Log4perl::Resurrector;
use Foobar;
then "Log::Log4perl::Resurrector" will have put a source filter in place that will extract all hidden Log4perl statements in "Foobar"
before "Foobar" actually gets loaded.
Therefore, "Foobar" will then behave as if the
###l4p DEBUG(...)
###l4p INFO(...)
...
statements were actually written like
DEBUG(...)
INFO(...)
...
and the module "Foobar" will indeed be Log4perl-enabled. Whether any activated Log4perl statement will actually trigger log messages, is up
to the Log4perl configuration, of course.
There's a startup cost to using "Log::Log4perl::Resurrector" (all subsequently loaded modules are examined) but once the compilation phase
has finished, the perl program will run at full speed.
Some of the techniques used in this module have been stolen from the "Acme::Incorporated" CPAN module, written by chromatic. Long live
CPAN!
COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.12.1 2010-02-07 Resurrector(3)