How to hold string array in shell scripts

Gents,

Below is the Shell script which I am trying to hold a string of array that is passed from a java file. But it is not working . Can any one please help me to by fixing it.

#!/bin/csh/
set copy = ($argv[*])
echo $copy[1] >> /home/users/bavananr/rrr.log
echo $copy[2] >> /home/users/bavananr/rrr.log
echo $copy[3] >> /home/users/bavananr/rrr.log
echo $copy[4] >> /home/users/bavananr/rrr.log

this should print - Raj Sok Rajesh brajesh
------------------------------------------------------
Below is the java program that i used to call above shell script.
It sucks :mad:

public class sample
{
public static void main(String args[]) {
String strCmd = "/home/users/bavananr/Raj.sh";
String str [] = {"Raj","Sok","Rajesh","brajesh"};
Process proc = null;
try{
proc = Runtime.getRuntime().exec(strCmd,str);
}catch (Exception e) {
System.out.println("Exception occurs "+e);
}
}
}

try this

col_look="this is test"
set -A look $col_look
echo "${look[1]}"
echo "${look[2]}"
echo "${look[0]}"

hi ,

My problem when string is "passed" as a parameter from java program and I would like to have a script how to hold the string array parameter and use it further

Thanks :rolleyes:

try this

x=$@
echo $x
set -A look $x
echo ${look[0]}