linux bash - how to use a dynamic parameter in shell parameter expansion expression
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} 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} Code:
IMORGEN=$(date --date=tomorrow +%Y%m%d%H%M) Code:
${$(date --date=tomorrow +%Y%m%d%H%M):6:2} thanks in advance =) Nick |
ok, i just realized i could do this to accomplish the same thing:
Code:
$(date --date=tomorrow +d%) Nick |
but i can't seem to figure out how to do this dynamically (without setting a variable) inside the parameter expansion phrase.
AFAIK you can't. |
All times are GMT -5. The time now is 06:02 PM. |