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

Re: Unsetting Array

"@ Rocteur CC" wrote:
> I'm starting to worry about these issues... We have thousands of  
> scripts, this is going to take some time if little things in ksh break  
> in zsh.
> Is there somewhere a good document or site where other who have  
> migrated from ksh to zsh have listed all these things they have come  
> up against.

I'm not aware of one, although it would be a very useful project to
start at zshwiki.org.

However, note that there is a somewhat outdated list of incompabilities
in the zsh FAQ which is online at http://zsh.sunsite.dk/FAQ/ and in the
source archive (which is nowadays the master copy).

The issue you ran across could do with mentioning.

Index: Etc/FAQ.yo
RCS file: /cvsroot/zsh/zsh/Etc/FAQ.yo,v
retrieving revision 1.44
diff -u -r1.44 FAQ.yo
--- Etc/FAQ.yo	30 Oct 2008 12:18:54 -0000	1.44
+++ Etc/FAQ.yo	10 Dec 2008 09:49:14 -0000
@@ -541,6 +541,12 @@
         mytt($array) refers to the whole array, not tt($array[0]);
         braces are unnecessary: tt($a[1] == ${a[1]}), etc.
         Set the tt(KSH_ARRAYS) option for compatibility.
+    it()  Furthermore, individual elements of arrays in zsh are always
+        strings, not separate parameters.  This means, for example, you
+	can't `unset' an array element in zsh as you can in ksh; you
+	can only set it to the empty string, or shorten the array.
+	(You can unset elements of associative arrays in zsh because
+	those are a completely different type of object.)
     it()  Coprocesses are established by mytt(coproc); mytt(|&) behaves like
         csh.  Handling of coprocess file descriptors is also different.
     it()  In mytt(cmd1 && cmd2 &), only mytt(cmd2) instead of the whole

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

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