Variable in Variable name?

Hi I am writing a script to show the current users and their current processes along with their actual name, tty, pid etc...

I am thinking the best method is to cut the infomation from the who, finger and w commands using a temp file to store and then pull the info from.

Inorder to set the unsernames to variables ($user1, user2...) I am attempting to set a variable as follows:

$user${pos}=$1

pos is simply one and is set previously in the code, but the problem lies with a command not found error which comes after this statement.

Any ideas?? -- thanks

Also anyone know how i can copy the code from vi so I can paste it into my browser?? cheers

You must use the eval command :

eval user${pos}=$1

Instead of using variables user1, user2,... you can use an array :

${user[$pos]}=$1

Jean-Pierre.

I will give that go - Thanks for your help!