PDA

View Full Version : eval array.



J05HYYY
December 31st, 2009, 03:52 PM
sorry to keep litter bombing this forum, I seem to find myself coming across niggley mistakes... any suggestions much appreciated.


#!/bin/sh
i=0
text="why wont spaces work? how can I get them to work?"
eval array${i}="$text"
eval echo "\$array${i}"

Arndt
December 31st, 2009, 04:33 PM
sorry to keep litter bombing this forum, I seem to find myself coming across niggley mistakes... any suggestions much appreciated.


#!/bin/sh
i=0
text="why wont spaces work? how can I get them to work?"
eval array${i}="$text"
eval echo "\$array${i}"

Shouldn't you have /bin/bash instead of /bin/sh?

J05HYYY
December 31st, 2009, 04:35 PM
no, I want to use sh.

got it now:


#!/bin/sh
i=0
text="why wont spaces work? how can I get them to work?"
eval array${i}='$text'
eval echo "\$array${i}"

ta :)