22 Aug
2006
22 Aug
'06
15:03
On Tuesday 22 August 2006 13:20, Jan Engelhardt wrote:
I have the following script fragment:
tags=( $( vorbiscomment "$1") ) for tag in $(seq 0 $((${#tags[@]} - 1))) do echo ${tags[$tag]} done
sifs="$IFS"; IFS=' '; tags=(`vorbiscomment "$1")); IFS="$sifs";
Yes, this saves the use of external tools. And with this variation one does not need to save the IFS-variable: leen@ws-03:~> IFS=' ' a=(`echo -en "a a\nb b"`) leen@ws-03:~> declare -p a declare -a a='([0]="a a" [1]="b b")' ;)
for tag in "${tags[@]}"; do echo "$tag"; done;
Cheers, Leen