2

cmdline> ls -la /.myScript.sh

   set index=0
    set usrlist[index]="null" 


        while read line
        do

        #Total lines read
        z=`echo $line| wc -l`
        lines=`expr $lines + $z`    

        # 2) #total unique user
        linesED=`echo $line | sed 's/[0-9]//g'`
        linesEDA=`echo ${linesED:10}` 
        userr=`echo $linesEDA | awk '{print $1}'`  

        for i in z
        do
            usrlist[i]=$userr
        done
            index=`expr $index + $i`
            echo ${usrlist[index]}# prints out data correctly but with 
                                  #error expr:non-integer argument 
        done
 echo ${usrlist[index]}#here blank output only

I want to print out all the memebers of array at end, without error

1
  • 1
    Take a look at: shellcheck.net Commented May 3, 2015 at 13:07

1 Answer 1

0

You need to introduce a file for done of while such as :

done < myfile.txt
1
  • thank you , but I managed to do it in another way..thanks for the help though Commented May 3, 2015 at 13:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.