![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Counting files in one directory | matrixtlm | UNIX for Dummies Questions & Answers | 10 | 06-15-2007 04:14 PM |
| Counting number of files in a directory | iamalex | UNIX for Dummies Questions & Answers | 2 | 09-05-2005 07:13 AM |
| List files that do not match the search pattern | olapxpert | UNIX for Dummies Questions & Answers | 7 | 04-14-2005 12:49 PM |
| List files that do not match the search pattern | olapxpert | IP Networking | 1 | 04-14-2005 11:37 AM |
| rm files in a directory, looping, counting, then exit | JporterFDX | Shell Programming and Scripting | 6 | 07-18-2002 05:56 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#29
|
||||
|
||||
|
Quote:
Add a space befor the ] in the test statement whithin the for loop Code:
#!/bin/ksh
dir=/biddf/ab6498/dev/ctl
export dir
set -x
myfilepattern=$@
fullpattern=${my_filepattern}_???_$(date +%Y%m%d)
integer filecount=0
for file in $fullpattern ; do
[ "$file" != "$fullpattern" ] && filecount=$filecount+1
done
if (( $filecount == 10 )); then
print "success"
exit 0
else
print "failure"
exit 1
fi
|
| Forum Sponsor | ||
|
|
|
#30
|
||||
|
||||
|
You need a space between the " and the ] in:
Code:
[ "$file" != "$fullpattern"] |
|
#31
|
|||
|
|||
|
Jean,
That works perfect!! I just got a question don't the condition need to be reverse of what we have in the for loop condition. I marked it in red. Kindly suggest. #!/bin/ksh -x dev='/biddf/ab6498/dev/ctl' cd $dev echo $dev Quote:
|
|
#32
|
|||
|
|||
|
Jean,
I am sorry. I got why we should have negate condition. Thanks for the help. Once again thanks for your great help. |
|||
| Google The UNIX and Linux Forums |