IFS=','read -ra tokens <<< "$contents" ## your list for x in "${tokens[@]}" do mkdir $x cd $x # so something tough $x.txt cd .. done