zsh-users
 help / Atom feed
From: "David C. Rankin" <drankinatty@suddenlinkmail.com>
To: zsh-users@zsh.org
Subject: help adapting bashism for zsh
Date: Sun, 9 Jun 2019 19:33:09 -0500
Message-ID: <dc644109-52d9-38e3-277d-ed12a218e0ac@suddenlinkmail.com> (raw)

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.

             reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  0:33 David C. Rankin [this message]
2019-06-10  5:41 ` Roman Perepelitsa
2019-06-10 14:43   ` David C. Rankin
2019-06-10 14:53     ` Roman Perepelitsa
2019-06-10 17:34       ` Ray Andrews
2019-06-10 21:55         ` David C. Rankin
2019-06-10 20:22 ` Bart Schaefer
2019-06-10 22:31   ` David C. Rankin
2019-06-11  8:56     ` Peter Stephenson

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc644109-52d9-38e3-277d-ed12a218e0ac@suddenlinkmail.com \
    --to=drankinatty@suddenlinkmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/ public-inbox