[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

array arguments in ksh

Posted on 2004-10-27
1
Medium Priority
?
2,067 Views
Last Modified: 2013-12-26
I'm writing a general function to process an array of strings, and I want that function to be able to receive the array as an argument.  Simple enough, right?  Well, given the following:

###########
function testit {
  echo $1 $2 $3
}

a[0]="hello world"
a[1]=goodbye

testit ${a[*]}
###########

this outputs:
hello world goodbye

Is there a way to pass in the *actual* array, and not the array elements joined by spaces?  I want to be able to recreate the array in the function, but the korn shell is a bit limited here...unless I'm missing something??

Thanks...
0
Comment
Question by:simulant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 12451950
> Is there a way to pass in the *actual* array, and not the array elements joined by spaces?
AFAIK not with ksh

>  I want to be able to recreate the array in the function,
the array has to be a global variable
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question