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

Re: (s) splitting - is there any way to provide "dynamic" separator



On Oct 11,  8:38am, Han Pingtian wrote:
}
} % a=11::22:33;print -l ${(ps.\0.)a//:/$'\0'}
} 11
} 22
} 33
} % a=11::22:33;print -l "${(ps.\0.)a//:/$'\0'}"
} 11$''$''22$''33
} %
} 
} Looks like $'\0' in double-quotes is converted to $'' and it doesn't equal
} to \0 ?

Although it looks like an expansion, $'...' is actually a form of quotes,
and therefore cannot be used inside a double-quoted string.

The \0 is actually being removed by "print -l".  Add the -R option:

torch% a=11::22:33;print -l -R "${(ps.\0.)a//:/$'\0'}" 
11$'\0'$'\0'22$'\0'33
torch% 



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