Hi folks,
again I'm trying to write a shell script and again I'm facing a problem ...
What I'd like to do is the following:
Here's the tricky part:
I don't want the variable to be named InputX !
It's supposed to change according to the $Counter value so that it looks like this:
$Counter=0 -> Variable is supposed to be named Input1
$Counter=1 -> Variable is supposed to be named Input2
... and so on
What I tried was the following:
But that's not working ...
What would be the correct approach here ?
Regards
Thomas
again I'm trying to write a shell script and again I'm facing a problem ...
What I'd like to do is the following:
Code:
Counter=0
while [ $Counter -le 3 ];
do
InputX=$(cat /tmp/lst$Counter | awk '{print $1}')
Counter=`expr $Counter + 1`
done
Here's the tricky part:
I don't want the variable to be named InputX !
It's supposed to change according to the $Counter value so that it looks like this:
$Counter=0 -> Variable is supposed to be named Input1
$Counter=1 -> Variable is supposed to be named Input2
... and so on
What I tried was the following:
Code:
Input$Counter=$(cat /tmp/lst$Counter | awk '{print $1}')
But that's not working ...
What would be the correct approach here ?
Regards
Thomas