Question on NULL and zero value of variable

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question on NULL and zero value of variable
# 8  
Old 09-28-2011
Yes the variable must be quoted so the test "sees" the null.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If grep value is null then assign 0 to variable

DELETE=`cat $logfile1 | egrep -i "Delete" | sed 's/ */ /g' | cut -d" " -f2` INSERT=`cat $logfile1 | egrep -i "Insert" | sed 's/ */ /g' | cut -d" " -f2` UPDATE=`cat $logfile1 | egrep -i "Update" | sed 's/ */ /g' | cut -d" " -f2` I need soming like below: if value is null... (8 Replies)
Discussion started by: Veera_V
8 Replies

2. Shell Programming and Scripting

If condition to check null variable

Guys, Please help me on the below sample.cfg var=NULL #!/bin/sh . /sample.cfg if ;then 1 st command here else 2 nd command here fi (3 Replies)
Discussion started by: AraR87
3 Replies

3. Shell Programming and Scripting

Value of variable is NULL, but test doesn't seem to recognize

Hello, Unix-forums! My problem: read -p "Enter any number, please" number sleep 1 echo $number | tr -d 0-9 test -z $number && echo "Thank you" || echo "This is not a number"Test always displays "This is not a number". It doesn't matter if I entered a or 1. But if I order echo... (2 Replies)
Discussion started by: intelinside
2 Replies

4. Shell Programming and Scripting

Newbie question: if[command not null]

hi, i have to put in my script a command that should tell me if the contents of two different paths are the same. I thought to write an "if" command who makes the diff of two files which contains the `ls` of the folders and go on with the script if is not null, but i'm afraid of the fact... (13 Replies)
Discussion started by: zangarules
13 Replies

5. Shell Programming and Scripting

how to check null variable

korn shell If then update_smartcare_user_password "$u_id" else echo "Not a database user" fi i get this error Syntax error at line *** : `then' is not expected. what should i do. I want to check whether $a is null or not. (2 Replies)
Discussion started by: sachin.gangadha
2 Replies

6. Shell Programming and Scripting

test Null variable

hi forum i beginning with script and i want test un null variable in a schell i just don t know the syntax here is a litle example y=test echo $y unset y echo $y (so here Y = Null) if Y=Null then echo "y is null" exit fi (1 Reply)
Discussion started by: kykyboss
1 Replies

7. Shell Programming and Scripting

check for NULL variable

Hello I want to check for NULL variable.. but this is not working..please help thanks in advance esham (2 Replies)
Discussion started by: esham
2 Replies

8. Shell Programming and Scripting

How to filter a null variable.

I have the necessity to use this command: cat file1 | grep $A | grep $B where sometime A and, or, B are not set. For example: I set A=@ never defined or set B The above command send a cat error. Any idea? Thanks. Giovanni (1 Reply)
Discussion started by: gio123bg
1 Replies

9. UNIX for Dummies Questions & Answers

/dev/null 2>&1 question

Hi, suppose you have the following line at your crontab : 5 * * * * /usr/mine/script > /dev/null 2>&1 now i understood that the " > /dev/null 2>&1 outputs both Standard outpout and Standard Error messages to the /dev/null device or file... the first part , " > /dev/null " transfers... (1 Reply)
Discussion started by: BAM
1 Replies

10. Shell Programming and Scripting

PERL: how to tell if variable is NULL

How to I do a check on a variable to see if it's null-- I am using Perl. (4 Replies)
Discussion started by: dangral
4 Replies
Login or Register to Ask a Question
Net::DNS::Question(3)					User Contributed Perl Documentation				     Net::DNS::Question(3)

Net::DNS::Question - DNS question record SYNOPSIS
use Net::DNS::Question; $question = new Net::DNS::Question('', 'A', 'IN'); DESCRIPTION
A Net::DNS::Question object represents a record in the question section of a DNS packet. METHODS
new $question = new Net::DNS::Question('', 'A', 'IN'); $question = new Net::DNS::Question(''); $question = new Net::DNS::Question('', 'PTR', 'IN'); $question = new Net::DNS::Question(''); Creates a question object from the domain, type, and class passed as arguments. One or both type and class arguments may be omitted and will assume the default values shown above. RFC4291 and RFC4632 IP address/prefix notation is supported for queries in both and namespaces. decode $question = decode Net::DNS::Question($data, $offset); ($question, $offset) = decode Net::DNS::Question($data, $offset); Decodes the question record at the specified location within a DNS wire-format packet. The first argument is a reference to the buffer containing the packet data. The second argument is the offset of the start of the question record. Returns a Net::DNS::Question object and the offset of the next location in the packet. An exception is raised if the object cannot be created (e.g., corrupt or insufficient data). encode $data = $question->encode( $offset, $hash ); Returns the Net::DNS::Question in binary format suitable for inclusion in a DNS packet buffer. The optional arguments are the offset within the packet data where the Net::DNS::Question is to be stored and a reference to a hash table used to index compressed names within the packet. name $name = $question->name; Internationalised domain name corresponding to the qname attribute. Decoding non-ASCII domain names is computationally expensive and undesirable for names which are likely to be used to construct further queries. When required to communicate with humans, the 'proper' domain name should be extracted from a query or reply packet. $query = new Net::DNS::Packet( $example, 'ANY' ); $reply = $resolver->send($query) or die; ($question) = $reply->question; $name = $question->name; qname, zname $qname = $question->qname; $zname = $question->zname; Canonical ASCII domain name as required for the query subject transmitted to a nameserver. In dynamic update packets, this attribute is known as zname() and refers to the zone name. qtype, ztype $qtype = $question->qtype; $ztype = $question->ztype; Returns the question type attribute. In dynamic update packets, this attribute is known as ztype() and refers to the zone type. qclass, zclass $qclass = $question->qclass; $zclass = $question->zclass; Returns the question class attribute. In dynamic update packets, this attribute is known as zclass() and refers to the zone class. print $object->print; Prints the record to the standard output. Calls the string() method to get the string representation. string print "string = ", $question->string, " "; Returns a string representation of the question record. COPYRIGHT
Copyright (c)1997-2002 Michael Fuhr. Portions Copyright (c)2002-2004 Chris Reinhardt. Portions Copyright (c)2003,2006-2011 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl, Net::DNS, Net::DNS::DomainName, Net::DNS::Packet, RFC 1035 Section 4.1.2 perl v5.18.2 2014-01-16 Net::DNS::Question(3)