Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

share|improve this question
1  
Take a look at: shellcheck.net –  Cyrus May 3 at 13:07

1 Answer 1

up vote 0 down vote accepted

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

done < myfile.txt
share|improve this answer
    
thank you , but I managed to do it in another way..thanks for the help though –  LogicianUnix May 3 at 13:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.