Typeset is not working in Linux korn shell scripting

Hi All,

Kindly help on the below issue ASAP. Its very urgent.

I have script in which we have below two lines for code and it is not working. Please help.

files_to_process="
abc_*.log
def_*.log
ghi_*.log
"

typeset -A dir_list ${files_to_process}

the script is failing in Linux korn shell with below error.

-ksh: typeset: abc_*.log: invalid variable name

Thanks in Advance.

Please be aware that statements like "ASAP" and "very urgent" are highly deprecated in these forums.

Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.

Thank you.

The UNIX and Linux Forums

It's not clear what you want to achieve with your failing command. Is it an associative array with the file names as indexes? As element values?

In addition to what RudiC has already said, if you are trying to create an associative array with filenames as the indexes in your arrray, you need to also specify that values that are to be assigned to those elements in the array. For example:

typeset -A dir_list=([abc_123.log]=6 [abc_234.log]=29 [def_357.log]="a string" ["ghi_12()x.log"]="something else")

If you just wanted an indexed array where the filenames are the values of elements with indexes 0 through 3 (assuming the same four file matching your patterns exist in the directory in which you run your script, then just try:

dir_list=(abc_*.log def_*.log ghi_*.log)