The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 12-06-2007
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 580
Hi.

Using other csh / tcsh constructs:
Code:
#!/bin/tcsh

# @(#) s1       Demonstrate csh variable contents test.

echo "checking length of name"
if ( ${?name} == 0 ) then
        echo " Variable name is not set."
endif

#  NOTE - $ % construct tcsh only.

set name
if ( ${%name} == 0 ) then
        echo " Variable name has 0 characters as value."
endif

# if( "$nmlfilelist" == "" ) then
if( "${?nmlfilelist}" == 0 ) then
    echo "nmllist is empty"
    exit( 1 )
endif

exit 0
Produces:
Code:
% ./s1
checking length of name
 Variable name is not set.
 Variable name has 0 characters as value.
nmllist is empty
Best wishes ... cheers, drl

_____
Standard advice: avoid csh family for scripting.
Reply With Quote