awk returns null?

hi
i try to check if awk returns null
and i dont know how it's works

this is the command
set EndByC = `ls -l $base | awk '/.c$/ {print $9}'`
if ($EndByC=="") then #check if ther is XXX.c directory
echo Sorry ther is no XXX.c folder "in" $base path
echo the XXX.c folder is necessary to build the Makefile, please check again the path of this folders
exit 1
10X
or

Hi.

Are you testing if any C files exist?

You can use something like

ls $base/*.c > /dev/null 2>&1
if [ $? -ne 0 ]; then #no files
  echo Sorry ther is no XXX.c folder "in" $base path
  echo the XXX.c folder is necessary to build the Makefile, please check again the path of this folders
  exit 1
fi

ls will return an error (2) if no files exist, so there's really no need for awk, actually.

Assuming "$base" is a directory, ls will never return "NULL" with the -l option.

mkdir BLAH
ls -l BLAH
 
total 0

awk doesn't/can't return null. It's return (as an int) can be set by the exit directive....

I believe the O/P means an empty string.

ok
$base is a directory that should end with ".c" so i wont to check if any XXX.c dirs are exist
what it's > /dev/null 2>&1
end [ $? -ne 0 ]?

Ok, too much!

if [ -d $base ]; then
  echo directory $base exists
else
  echo directory $base does not exist
fi

Worry about the other stuff later...

sorry again
$base - is the path that given to the script
and in this path($base) i need a list of all the ???.c directory
and if there is not ???.c dir.. print error
???.c-(any directory that end with .c)
ok?