say that i want to use parameter expansion to parse out characters 7 and 8 in a string, but i want to generate that string dynamically inside the parameter expansion phrase. how do i do that?
format:
Code:
${parameter:offset:length}
what parameter will look like:
20060822105030
i want what is bold. this works fine on the command line:
Code:
export imorgen=$(date --date=tomorrow +%Y%m%d%H%M);echo ${imorgen:6:2}
or in a script file:
Code:
IMORGEN=$(date --date=tomorrow +%Y%m%d%H%M)
echo "today is day number ${imorgen:6:2}"
but i can't seem to figure out how to do this dynamically (without setting a variable) inside the parameter expansion phrase. i've tried this, but it doesn't work:
Code:
${$(date --date=tomorrow +%Y%m%d%H%M):6:2}
i get a
bad substitution error. anybody know how to do this?
thanks in advance =)
Nick