LINUX.ORG.RU

История изменений

Исправление intelfx, (текущая версия) :

Гм, чего? Кроме ${array[@]} есть ещё и ${array[*]}.

$ array=('first entry' 'second entry' 'third entry')

$ printf "entry is '%s'\n" "${array[@]}"
entry is 'first entry'
entry is 'second entry'
entry is 'third entry'

$ printf "entry is '%s'\n" "${array[*]}"
entry is 'first entry second entry third entry'

$ IFS=:; echo "${array[*]}"; unset IFS
first entry:second entry:third entry

Исходная версия intelfx, :

Гм, чего? Кроме ${array[@]} есть ещё и ${array[*]}.

Поясняю на примере:

$ array=('first entry' 'second entry' 'third entry')

$ printf "entry is '%s'\n" "${array[@]}"
entry is 'first entry'
entry is 'second entry'
entry is 'third entry'

$ printf "entry is '%s'\n" "${array[*]}"
entry is 'first entry second entry third entry'

$ IFS=:; echo "${array[*]}"; unset IFS
first entry:second entry:third entry