bash brace expansion based on variable content not working
问题 how can i make bash expand whatever it finds in a variable i pass to mkdir? so far i've tried using eval and bash -c , but nothing seems to work LEVEL_1=1,2,3 LEVEL_2=a,b,c DATA_L1="/tmp/{$LEVEL_1}" DATA_L2="$DATA_L1/{$LEVEL_2}" for LINE in $(cat file.txt) ; do #"cat" here returns values like #$DATA_L2/yy/data mkdir -pv $LINE #it actually contains e.g. this $DATA_L2/yy/data done i would expect that this will expand to mkdir -p /tmp/1/a/yy/data mkdir -p /tmp/2/a/yy/data mkdir -p /tmp/3/a/yy