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

Re: In POSIX mode, ${#var} measures length in bytes, not characters



On Jun 7,  3:34am, ZyX wrote:
} Subject: Re: In POSIX mode, ${#var} measures length in bytes, not characte
}
} 07.06.2015, 03:29, "Martijn Dekker" <martijn@xxxxxxxx>:
} > When in 'emulate sh' mode, ${#var} substitutes the length of the
} > variable in bytes, not characters. This is contrary to the standard; the
} > length in characters is supposed to be substituted.[*]
} >
} > Oddly enough, zsh is POSIX compliant here in native mode, but
} > non-compliant in POSIX mode.
} 
} Do you have a reference where "character" is defined? This behaviour
} is the same in posh and dash:

I thought this was discussed on the austin-group list but I can't find a
search term to dig it out of the archives.  (I did find the thread about
${##} as a side-effect of the attempt.)

On my Ubuntu 12.04 system, /bin/sh is a link to dash, so zsh invoked
as sh behaves like /bin/sh.  On CentOS, /bin/sh links to bash, so they
behave differently.



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