Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'if' help

Status
Not open for further replies.

RichS24

Technical User
Aug 21, 2002
28
GB
Hi,

i have the following script, where i'm looking for 2 different actions dependant on the outcome.
However, no matter what i do, the script just performs the same action. can you help please

cheers

Rich


#!/bin/ksh


WORKING_DIR=/opt/openv/netbackup/scripts/daily
recipients=$WORKING_DIR/to_email
word="inactive"
file=$WORKING_DIR/nbftconfig.txt

cmd=$(grep -ci "$word" $file)

if [ "cmd" != "0" ]; then
cat $file | unix2dos | uuencode $file | mailx -s "Inactive San Client Devices" rs@test.com
else
mailx -s "all Looks Hinky Dorey" rs@test.com


Cheers
richs24

[yoda]
 
if [ "[!]$[/!]cmd" != "0" ]; then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks for that, but as soon as i put the $ in, then it just sits there and doesnt return to the command line

Cheers
richs24

[yoda]
 
and doesnt return to the command line
even if you type the EOL char (usually Ctrl-D) ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
if you press ctrl-D, then it asks for a cc (as in email cc), and then pressing enter makes it work.
WHy is it waiting for a cc?

Cheers
richs24

[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top