Convert numbers to enumeration of strings in bash
- by User1
Using bash, I have a list of strings that I want to use to replace an int. Here's an example:
day1=Monday
day2=Tuesday
day3=Wednesday
day4=Thursday
day5=Friday
day6=Saturday
day7=Sunday
If I have an int, $dow, to represent the day of the week, how do I print the actual string? I tried this:
echo ${day`echo $dow`}
but get error of "bad substitution". How do I make this work? Note: I can change the $day variables to a list or something.