Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: kinda perl split ...



Dominic Mitchell wrote:

  echo foo bar | while read a b junk
  do
    echo "a=$a b=$b"
  done


so if the separator is ':', you should redefine IFS

oldIFS=$IFS
IFS=':'
echo foo bar | while read a b junk
do
     echo "a=$a b=$b"
done
IFS=$oldIFS
oldIFS=

or with a subshell:

( IFS=':'
echo foo bar | while read a b junk
do
     echo "a=$a b=$b"
done )




Messages sorted by: Reverse Date, Date, Thread, Author