Amanda-Users

RE: chg-zd-mtx help !

2003-05-28 09:57:59
Subject: RE: chg-zd-mtx help !
From: donald.ritchey AT exeloncorp DOT com
To: roli AT ains DOT at, Manjit.Notay AT ebookers DOT com
Date: Wed, 28 May 2003 08:55:29 -0500
Typically this problem occurs in shell scripts which are testing the value
of a 
variable that has not been set.  The work around for this is to rewrite the
script to put variables of unknown (and possibly null/blank) values inside
double quotes (").  This lets the shell know that the value to be tested
is present but null valued.

For example: (Korn/Bourne/Bash shell assumed)

# Failing case
foo='';
if [ $foo = bar ]
then
        : blah
fi

As the shell sees this:
.....
if [ = bar ]
then
.....

# Should be
foo='';
if [ "$foo" = "bar" ]
then
        : blah
fi

If you are doing numeric comparisons, then have the shell set 
the variable to an impossible value and then check for that as 
well as your expected values.

# foo valid values are 0 to 1000;
foo='';

if [ ${foo:-999999} = 999999 ]
then
        : error handling here
else 
        : normal processing
fi

Hope that helps,

Don
Donald L. (Don) Ritchey
E-mail:  Donald.Ritchey AT exeloncorp DOT com


-----Original Message-----
From: Roland Schützner [mailto:roli AT ains DOT at]
Sent: Wednesday, May 28, 2003 8:16 AM
To: Manjit Notay
Cc: 'amanda-users AT amanda DOT org'
Subject: Re: chg-zd-mtx help !


Hi!

Manjit Notay wrote:
 > Hi all
 > I have successfully managed to install amanda and mtx on a solaris 8 
system.
 > i can use mtx to manipulate my overland 10 tape autochanger, but whenever
 > i run ./chg-zd-mtx -info i get the response,
 >
 > chg-zd-mtx: test: argument expected
 >
 > please can someone shed some light.
 >

Well, my solaris days were some years ago, but a LOT of the standard
tools doesn't work "as expected".
But I had also some small issues on linux recently with the chg-zd-mtx
shell script, that is, ALL parameters had to be set in the
chg-zd-mtx.conf. Leaving some values commented out to simply let the
script take its default values led to trouble.

What I do in such situations (concerning shell scripts) is to set
debugging on:

insert "set -x" into the script at the point where U want to start
debugging, i.e. right below the #!/bin/sh in chg-zd-mtx.

If U can't find a quick solution, maybe trying bash is an option?

hope that helps a bit

Cheers,

-roli

 > regards,
 > Manjit Notay
 >
 >
 >
 > Click Here For Special Deals
 >
 > http://www.ebookers.com
 >
 > This email including any attachments is confidential and may be legally
 > privileged. If you have received it in error please advise the sender
 > immediately by return email and then delete it from your system.The
 > unauthorized use, distribution, copying or alteration of this email is
 > strictly forbidden.
 >
 >
 >

-- 
Dipl.-Ing. Roland Schützner
Technical Management
All Information Network & Services GmbH
email: roland.schuetzner AT ains DOT at
phone: +43/662/45 23 35-20
fax:   +43/662/45 23 35-90


************************************************************************
This e-mail and any of its attachments may contain Exelon Corporation
proprietary information, which is privileged, confidential, or subject 
to copyright belonging to the Exelon Corporation family of Companies. 
This e-mail is intended solely for the use of the individual or entity 
to which it is addressed.  If you are not the intended recipient of this 
e-mail, you are hereby notified that any dissemination, distribution, 
copying, or action taken in relation to the contents of and attachments 
to this e-mail is strictly prohibited and may be unlawful.  If you have 
received this e-mail in error, please notify the sender immediately and 
permanently delete the original and any copy of this e-mail and any 
printout. Thank You.
************************************************************************



<Prev in Thread] Current Thread [Next in Thread>