LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 10-09-2003, 12:18 AM   #1
rche3252
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-09-2003, 12:43 AM   #2
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

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

Code:
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-09-2003 at 12:45 AM.
 
  


Reply


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-20-2011 12:01 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM
A problem about a shell script jpan Linux - General 2 01-19-2005 07:14 PM
MAJOR problem ... bash script array HELP !!!!! michael_util Slackware 1 02-13-2004 07:51 AM
Shell-Script Problem? x4v013 Slackware 7 09-17-2003 01:15 AM


All times are GMT -5. The time now is 11:43 AM.

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