![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| echo statement when find returns null | tchoruma | UNIX for Dummies Questions & Answers | 2 | 09-24-2009 08:13 AM |
| PEM_read_RSAPublicKey returns NULL | Treasa | High Level Programming | 1 | 11-20-2008 09:22 AM |
| gethostbyname_r returns NULL when hostname has dash | uunniixx | IP Networking | 12 | 06-04-2008 02:02 AM |
| compare null with non-null | nitin | Shell Programming and Scripting | 8 | 11-04-2006 07:58 PM |
| longjmp never returns | axes | High Level Programming | 2 | 09-10-2006 09:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 Code:
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. Code:
mkdir BLAH ls -l BLAH total 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|