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


array arguments in ksh

Posted on 2004-10-27
Medium Priority
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"

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??

Question by:simulant
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

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

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