On 05Jul2006 21:50, sarvin <[EMAIL PROTECTED]> wrote:
| I'm trying to learn bash shell scripting, by writing a script, using  
| an array. I'm finding plenty of information about arrays but nothing  
| about making elements within an array integers.
| 
| I'm trying to make a while loop with
| 
| count=1
| chapter=1
| amount=( 50 40 27 36 34 )
| 
| while [ $chapter -le ${amount[$count]} ]; do
| 
| I'm getting the error "[: 51: unary operator expected"

Try running your script with the -x option. You can have the script turn
it on like this:

        set -x
        count=1
        chapter=1
        amount=( 50 40 27 36 34 )
        while [ $chapter -le ${amount[$count]} ]; do

See what [ ..... ] command is actually issued - that will reveal how the
"[" (test) command is being issued, and hopefully point the way to the
problem.

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

People who write "obtuse" to mean a mixture of "obscure" and  "abstruse" are
displaying their own obtuseness. - Eric Minch <[EMAIL PROTECTED]>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/0XFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be 
removed. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to