String Evaluation Not Working
I have the following code.
#! usr/bin/bash schemaPrefix=("aos") tables_aos=("A" "B" "C") for j in "${!schemaPrefix[@]}"; do aschema=${schemaPrefix[j]} schema=$aschema eval tables=tables_$aschema echo ${tables[@]} done The code should display: A B C However, it displays: tables_aos I have several lists. They are named as "table" followed by underscore and a suffix. For example, table_aos, table_apd, etc. I want to loop through all those lists and print the content of each list. |
try:
Code:
#!/bin/bash Code:
table data = A B C !is redirect and you should try to avoid eval where possible USE CODE TAGS! |
All times are GMT -5. The time now is 03:32 AM. |