[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: error in script



On 09/04/08 20:50, L.V.Gandhi wrote:
I have a script as follows
#!/bin/bash
rm -f ~/stock/flstock.csv
grep FUTSTK ~/stock/today/$1 |grep "25/09/2008"|cut -s -d, -f9|sort -nr > temp
i=0
for trv in $(cat temp)
do
    grep $trv ~/stock/today/$1 >> ~/stock/flstock.csv
    i=$((i+1))
    if [ $i -eq 20 ]
    then
    exit 0
    fi
done rm -f temp
cat ~/stock/flstock.csv |cut -s -d, -f2|sort >> ~/stock/fliquidstocks.txt

Last line is not getting executed . But if I run last line afterwards in console, it works.
Can someone throw somelight why it happens.

("temp" is a horribly generic name.)

Add "set -x" to the top of your script, to see exactly what happens.

--
Ron Johnson, Jr.
Jefferson LA  USA

"Do not bite at the bait of pleasure till you know there is no
hook beneath it."  -- Thomas Jefferson


Reply to: