help / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "David C. Rankin" <drankinatty@suddenlinkmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: help adapting bashism for zsh
Date: Mon, 10 Jun 2019 13:22:44 -0700
Message-ID: <CAH+w=7YdaTdCgG-fGycQTdFHobwSNUDQWZ3v=9gQa_B26y2bHQ@mail.gmail.com> (raw)
In-Reply-To: <dc644109-52d9-38e3-277d-ed12a218e0ac@suddenlinkmail.com>

On Sun, Jun 9, 2019 at 5:34 PM David C. Rankin
<drankinatty@suddenlinkmail.com> wrote:
> 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?

First thing -- how are these scripts executed?  E.g., are they run as
standalone processes via interpreter named in a "#!" line at the top,
or are they somehow pulled into an interactive shell, or something

If using the "#!" interpreter, the first thing to try is simply to
symlink that name to your zsh binary.  When invoked as (a path ending
in) "bash" or "sh" (or "ksh"), zsh enters a compatibility mode that
will resolve the most common issues.  You can then work on specific
problems with any scripts that are still failing.

This compatibility mode differs from setting individual options such
as KSH_ARRAYS, but can be fairly closely duplicated by using the
"emulate" command.  If the scripts are intended to become the bodies
of shell functions, try adding "emulate -L sh" at the top.

> Then what to do about the non-existing expansions such
> as ${foo^^} (uppercase) and ${foo,,} (lowercase), etc..

These are handled with (in those specific examples) ${foo:u} and
${foo:l}.  In fact ^^ has a completely different meaning in zsh, so
you will have to do a search-and-replace for those kinds of
nonstandard tricks.

  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  0:33 David C. Rankin
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 [this message]
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:

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

  git send-email \
    --in-reply-to='CAH+w=7YdaTdCgG-fGycQTdFHobwSNUDQWZ3v=9gQa_B26y2bHQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=drankinatty@suddenlinkmail.com \
    --cc=zsh-users@zsh.org \


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


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

Newsgroup available over NNTP:

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