Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
test for field existence
Name: camin Date: May 10, 2004 at 13:48:56 Pacific OS: SunOS 5.8 Generic_108528- CPU/Ram: unknown
Comment:
Hi,
Can someone please help! How do test to see if a field exist? The script is very long too long to paste in here: bugval is a ClearDDts command its just getting the field value from an sql database.
The conditions are that the field exist and has a value of "no"
man27=`$home/bin/bugval -i $i est27` if test $man27 = no && test X"$man27" != X then ma27=`$home/bin/bugval -i $i other3` echo $i >>$tempdir/w_$ma27.txt echo $ma27 >>$tempdir/w_man.txt fi thanks for any help. camin
Name: Jim Boothe Date: May 11, 2004 at 10:14:03 Pacific
Reply:
Since man27 might be null, you need to enclose it in quotes to avoid a script error:
if test "$man27" = no && test X"$man27" != X
Your test of man27 for not null is fine, except that it is redundant here. When man27 contains your required value of "no", that means also that it cannot possibly be null.
Other ways to check for non-null:
if test "$man27" != ""
if test -n "$man27"
0
Response Number 2
Name: camin Date: May 12, 2004 at 09:11:18 Pacific
Summary: Hi, I was just wondering if there was a way to test for a hardlink file using bourne shell ... I know [ -h filename ] checks for symbolic links... but what bout hardlinks? anybody?? Thanks! ...
Summary: I am working on a script that will test for a pattern. I have one line that checks to see if the argument entered is the file. I am unsure of how you test for file name. This is my script so far. if [...
Summary: David, I have done exactly that between a Sco OpenServe box and a DGUX box. I went down the path of creating a list of the current files then transfering them 1 by 1. If a successful status was retu...