Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: aramnani
5,456
Posted By RudiC
I'm afraid you'll have to deploy the dangerous...
I'm afraid you'll have to deploy the dangerous and deprecated eval like

while read -r line
do eval echo "\${!$line
}: \${$line
}"
done < file1.txt
0 1 2: 1...
5,456
Posted By Chubler_XL
Perhaps I'm misinterpreting your request but...
Perhaps I'm misinterpreting your request but would this suffice?

. ./file.txt
echo "a[1] = ${a[1]} a[2] = ${a[2]} a[3] = ${a[3]}"
echo "b[1] = ${b[1]} b[2] = ${b[2]} b[3] = ${b[3]}"
echo...
5,456
Posted By sea
Hi You would have better chances with your...
Hi

You would have better chances with your code, if you would save lists (var="1 2 3")in the file.txt, rather than arrays.
In which case, your code would work just fine - as it is right now.
...
Showing results 1 to 3 of 3

 

Featured Tech Videos

All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy