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

help adapting bashism for zsh



All,

  There is a lot I like about zsh, but almost an equal amount I don't. The
problem is how to handle adapting the 2566 POSIX and bash scripts I have to be
zsh compatible. The biggest issues are parameter-expansions, 1's indexing, and
issues with 'type' and other builtins being just enough different that my
existing scripts break when using zsh as the interpreter.

  Is there any collection of aliases, tweaks, brute-force sed scripts, etc..
that I could look at an pull parts from to handle most of the issues?

  For example with 'type', I can alias it to 'whence', but the documentation
for it is of little help with the expected behavior for type itself, e.g.

type [ -wfpamsS ] name ...

    Equivalent to whence -v.

at http://zsh.sourceforge.net/Doc/Release/Shell-Builtin-Commands.html, but the
options [ -wfpamsS ] largely have no effect on how type behaves.

  Then what to do with a large portions of the scripts that rely heavily on
string indexing and C-style for loops? The KSH_ARRAYS options is a temporary
bandaid for C-style loops, but that injects zsh incompatibility and the
documentation is absent on its effect on string indexing (e.g.
${foo:offset:length}). Then what to do about the non-existing expansions such
as ${foo^^} (uppercase) and ${foo,,} (lowercase), etc..

  In looking for solutions, I want to stay with core zsh solution, instead of
plugins, modules, etc...

  Is there some collection of information that helps with this transition
process, or is it largely a script-by-script rewrite to make the scripts
compatible?

-- 
David C. Rankin, J.D.,P.E.



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