On Tue, May 13, 2008 at 08:05:16PM -0500, Jordi Gutiérrez Hermoso wrote:
On 13/05/2008, L. V. Gandhi [EMAIL PROTECTED] wrote:
I have a script as follows
[snip]
i=$i+1
[snip]
How to correct it
Your counter is wrong. $i + 1 means to treat i as a string and to
append the
2008/5/15 L. V. Gandhi [EMAIL PROTECTED]:
Where am I wrong
With the knowledge of the content of your files it is easier to
answer. Running the script in trace mode is the best thing to do.
Anyway, I see that there are two problems here (which may or may not
be related to your problem):
for
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Where am I wrong
By the way, you might want to call your script as
bash -x scriptname
This will run the script in trace mode, much facilitating debugging.
You might also set PS4 to something sensible first. Personally, I
prefer PS4='+$0 l
On Thu, May 15, 2008 at 2:58 AM, L. V. Gandhi [EMAIL PROTECTED] wrote:
Now I changed this to
rm -f ~/lstock
i=0
for trv in $(cat temp)
do
while [ $i -ne 20 ]
do
i=$[i+1]
grep $trv stock/nsedata/2008/05/20080512.txt lstock
done
done
On Wed, May 14, 2008 at 3:05 AM, Jordi Gutiérrez Hermoso [EMAIL PROTECTED]
wrote:
On 13/05/2008, L. V. Gandhi [EMAIL PROTECTED] wrote:
I have a script as follows
[snip]
i=$i+1
[snip]
How to correct it
Your counter is wrong. $i + 1 means to treat i as a string and to
Am 2008-05-14 06:21:07, schrieb L.V.Gandhi:
I have a script as follows
[EMAIL PROTECTED]:~$ cat bin/getlstocks
#!/bin/bash
i=0
while [ $i -ne 20 ]
do
for trv in $(cat temp)
do
i=$i+1
i=$((i+1))
Thanks, Greetings and nice Day
Michelle
On Wed, May 14, 2008 at 8:54 AM, Todd A. Jacobs [EMAIL PROTECTED] wrote:
On Wed, May 14, 2008 at 06:21:07AM +0530, L.V.Gandhi wrote:
i=$i+1
This syntax is broken. Any of these alternatives will work:
- let i=$i+1
- let i+=1
- i=$(( i + 1 ))
Basically, you need
I have a script as follows
[EMAIL PROTECTED]:~$ cat bin/getlstocks
#!/bin/bash
i=0
while [ $i -ne 20 ]
do
for trv in $(cat temp)
do
i=$i+1
grep $trv stock/nsedata/2008/05/20080512.txt lstock
done
done
when I run I get error as
integer
On 13/05/2008, L. V. Gandhi [EMAIL PROTECTED] wrote:
I have a script as follows
[snip]
i=$i+1
[snip]
How to correct it
Your counter is wrong. $i + 1 means to treat i as a string and to
append the string 1 to it. If you want to do arithmetic in bash, you
have to put it inside
On Tue, May 13, 2008 at 08:05:16PM -0500, Jordi Guti?rrez Hermoso wrote:
If you want to do a lot of text manipulation, it may feel more natural
to use Perl (or at least it feels more natural to me).
Or Python. Or Ada.
Almost anything but sh.
Doug.
--
To UNSUBSCRIBE, email to [EMAIL
On Wed, May 14, 2008 at 06:21:07AM +0530, L.V.Gandhi wrote:
i=$i+1
This syntax is broken. Any of these alternatives will work:
- let i=$i+1
- let i+=1
- i=$(( i + 1 ))
Basically, you need to let bash know that $i is an integer, and not a
string.
--
Oh, look:
11 matches
Mail list logo