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
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.
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?