Convert numbers to enumeration of strings in bash
Posted
by User1
on Stack Overflow
See other posts from Stack Overflow
or by User1
Published on 2010-04-16T17:12:32Z
Indexed on
2010/04/16
17:13 UTC
Read the original article
Hit count: 152
bash
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.
© Stack Overflow or respective owner