Please help me with a simple problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please help me with a simple problem
# 1  
Old 10-27-2010
Please help me with a simple problem

Hi, I have a very simple script like below:
Code:
for n in 10 20 30
do
    for a in 30 40 50 60 70 80
    do
        for r in 2 3 4 5 6 7
        do
            m=$((r*a))
            count=1
            while ["$count" -lt "15"]
            do
                echo "a = " $a ", m = " $m ", n = " $n
                let count=${count}+1
            done
        done
    done
done

Can anyone tell me why I have this error: "27: [1: not found". 1 here is the value of count.
Thanks a lot.
# 2  
Old 10-27-2010
try:
Code:
while [ $count -lt 15 ]

This User Gave Thanks to jlliagre For This Post:
# 3  
Old 10-27-2010
Quote:
Originally Posted by jlliagre
try:
Code:
while [ $count -lt 15 ]

Thanks for your reply. Actually, at the beginning I wrote it exactly as above, but after I had encountered the error, I added "", but I still have the same error.


---------- Post updated at 05:03 PM ---------- Previous update was at 04:59 PM ----------



Thank you. I understand the problem. I must use [ $count, instead of [$count (no whitespace)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

simple wc problem

Hi there, Im sure there is a simple explanation for this but I have a file like this with no balnk lines peter paul john I run the command # var=`grep paul file.txt` # echo $var paul # echo $var | wc -l 1 but when I grep for a value that isnt in the file, i still... (4 Replies)
Discussion started by: rethink
4 Replies

2. Shell Programming and Scripting

another simple awk problem

Hello; I need to print two previous lines after searching for a reg exp: awk '/haywood/' should produce the following =================== p9J46THe020804 89922 Tue Oct 18 21:06 MAILER-DAEMON (host map: lookup (haywood.com): deferred) ... (1 Reply)
Discussion started by: delphys
1 Replies

3. Programming

Simple g++ compilation problem

I'm trying to port some code over to unix Solaris. I'm not really a unix programmer so I'm sure this is something straight-forwards but I'm getting the following: > g++ -c CTrade.cpp In file included from CTrade.cpp:1: stdafx.h:6: warning: `#pragma once' is obsolete CTrade.cpp:4: iostream: No... (1 Reply)
Discussion started by: achartley
1 Replies

4. Shell Programming and Scripting

Simple while-loop problem

Maybe because its Friday, but I can't get a simple while loop to work! #!bin/bash i=0 while do echo "Hello" ((i++)) done (17 Replies)
Discussion started by: linuxkid
17 Replies

5. Shell Programming and Scripting

simple awk problem

pcn linus> ntpq -p remote refid st t when poll reach delay offset disp ============================================================================== +smpnn01 ntpsrv1 2 u 829 1024 377 1.46 0.793 0.85 *smpnn02 ntpsrv1 2 u ... (2 Replies)
Discussion started by: arch12
2 Replies

6. Shell Programming and Scripting

Simple regex problem?

Hi all, I am looking to create words from a sentence which adhere to a custom search pattern from my website: Example: ! +! / += ~ where the terms ! = not, +! = AND NOT, += - and equals and ~ = can be like.... Now here is the issue...i want to split a sentence like the one above on... (1 Reply)
Discussion started by: muay_tb
1 Replies

7. Shell Programming and Scripting

simple date problem

i have a script that grep for today date a=`date +"%F"`--------greps current/today date wat if suppose i want to grep a date for yesterday... how to do that using the above format: i,e 2008-01-20 (4 Replies)
Discussion started by: ali560045
4 Replies

8. UNIX for Dummies Questions & Answers

Simple multiplication problem

I'am doing a tutorial where a simple calculator was given, then i noticed that you can't actually multiply this is how i have approached the problem so far. i just need if the user enters "*" to change it to "/*" ,is it possible? i know that * means the name of the last file in the directory... (8 Replies)
Discussion started by: greekozz
8 Replies

9. Shell Programming and Scripting

simple Bourne problem

Hi, I'm a newer for this languages, and I have a log file, which is something like this: 35.75.253.207 - - "GET /products/orgonizer/title.png HTTP/1.1" 200 1555 "-" "Mozilla 1.4" Now, I want to write a shell code to accoplish like ./XXX.sh -N n n is a number by user input, the code should... (5 Replies)
Discussion started by: pnxi
5 Replies

10. UNIX for Advanced & Expert Users

A simple Samba problem, please help

Hi, I have successfully setup my Samba server on my Sun Solaris 8 Sparc machine. My Win2000 workstation is able to see the unix worstation and its shared directory from Network Neighborhood. However, the Unix workstation appears as Ip address instead of Hostname on my network neighborhood... (5 Replies)
Discussion started by: champion
5 Replies
Login or Register to Ask a Question