Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-08-2003, 11:18 PM   #1
LQ Newbie
Registered: Oct 2003
Posts: 2

Rep: Reputation: 0
shell script array problem

I have some problem using the array, when i type "array1= (one two three)" in the shell it always gives me error messege says"error sytanx unexpected token array1=("
Old 10-08-2003, 11:43 PM   #2
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
This is how arrays are used....

array=( zero one two three four five )
echo ${array[0]}       #  zero
echo ${array:0}        #  zero
                       #  Parameter expansion of first element.
echo ${array:1}        #  ero
                       #  Parameter expansion of first element,
                       #+ starting at position #1 (2nd character).
echo ${#array}         #  4
                       #  Length of first element of array.
echo ${array[2]}
                       # two
<edit> If your doubt isn't clarified yet .... post your code...That will make things easier.

Welcome to LQ

Last edited by SaTaN; 10-08-2003 at 11:45 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash shell script split array robertngo Programming 13 06-19-2011 11:01 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
A problem about a shell script jpan Linux - General 2 01-19-2005 06:14 PM
MAJOR problem ... bash script array HELP !!!!! michael_util Slackware 1 02-13-2004 06:51 AM
Shell-Script Problem? x4v013 Slackware 7 09-17-2003 12:15 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration